Ver código fonte

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 anos atrás
pai
commit
4c7a4d98d4
1 arquivos alterados com 13 adições e 9 exclusões
  1. 13
    9
      main.c

+ 13
- 9
main.c Ver arquivo



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


#elif defined(_mk20dx128_) #elif defined(_mk20dx128_)
// 48 MHz clock by default // 48 MHz clock by default


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

// Enable Timers // Enable Timers
/* TODO Fixme!!
PIT_MCR = 0x00; PIT_MCR = 0x00;


// Setup ISR Timer for flagging a kepress send to USB // Setup ISR Timer for flagging a kepress send to USB
// 1 ms / (1 / 48 MHz) - 1 = 47999 cycles -> 0xBB7F // 1 ms / (1 / 48 MHz) - 1 = 47999 cycles -> 0xBB7F
PIT_LDVAL0 = 0x0000BB7F; PIT_LDVAL0 = 0x0000BB7F;
PIT_TCTRL0 = 0x3; // Enable Timer 0 interrupts, and Enable Timer 0 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 #endif
} }


// Setup USB Module // Setup USB Module
usb_setup(); usb_setup();


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


// Main Detection Loop // 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 ) while ( 1 )
{ {
// Setup the scanning module // Setup the scanning module
while ( scan_loop() ); while ( scan_loop() );
sei(); sei();


// XXX DEBUG
dPrint("AAAAAAA\r\n");
print("AAAAAAB\r\n");

// Run Macros over Key Indices and convert to USB Keys // Run Macros over Key Indices and convert to USB Keys
process_macros(); process_macros();


sendKeypressCounter = 0; sendKeypressCounter = 0;
sendKeypresses = 1; sendKeypresses = 1;
} }

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