2 \author Travis Goodspeed
3 \brief PS2 Timing Monitor for GoodFET
5 This module spies on PS/2. For now, it just reports the
6 inter-character timing information.
14 //! Handles a monitor command.
15 void ps2_handle_fn( uint8_t const app,
20 // define the ps2 app's app_t
21 app_t const ps2_app = {
33 "\tThe PS2 app spies on PS/2. For now, it just reports the\n"
34 "\tinter-character timing information.\n"
41 // Timer A0 interrupt service routine
42 interrupt(TIMERA0_VECTOR) Timer_A (void)
57 //! Handles a monitor command.
58 void ps2_handle_fn( uint8_t const app,
64 WDTCTL = WDTPW + WDTHOLD; // Stop WDT
65 TACTL = TASSEL1 + TACLR; // SMCLK, clear TAR
66 CCTL0 = CCIE; // CCR0 interrupt enabled
67 CCR0 = 0x100; //clock divider
69 _EINT(); // Enable interrupts
72 P5DIR&=~(TDI+TDO);//input mode
75 debugstr("Waiting for a keypress.");
76 //Wait for a keypress.
79 //Debounce the 1s polling
80 while((P5IN&TDI && P5IN&TDO))
81 while((P5IN&TDI));// && P5IN&TDO));
83 //Transmit the data only if it is new.
84 if((clock-oldclock)>0x100){
85 cmddatalong[0]=clock;//-oldclock;
86 cmddatalong[0]-=oldclock;
95 debugstr("Unknown ps2 verb.");