630
Appendix A: System Routines — Interrupts
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
idle
(continued)
if ( !OSTimerExpired( APD ) && !OSTimerExpired( USER ) && !kbhit() ) {
idle(); /* Stop CPU, but keep LCD alive . . . save power */
}
if ( OSTimerExpired( APD ) ) { /* if the APD timer went off */
off(); /* turn the calculator off until they turn it on */
OSResetTimer( APD ); /* reset APD */
continue; /* go back to looking for keys */
}
if ( OSTimerExpired( USER ) ) /* Timer elapsed */
i = EX_TIMEOUT; /* If key hit and timer, key hit takes precedence. */
if ( kbhit() ) {
switch ( i = ngetchx() ) {
case KB_ON+KB_OPTION:
i = EX_OPT_OFF; /* for next loop around */
off(); /* turn the calculator off until they turn it on */
break;
case KB_OFF:
i = EX_2ND_OFF; /* signal they want to quit */
off(); /* turn the calculator off until they turn it on */
break;
default:
i = EX_KEY; /* regular key hit */
pushkey( i ); /* push the key back to key queue */
}
OSResetTimer( APD ); /* reset APD */
}
if ( OSOnBreak ) /* Break key */
i = EX_BREAK;
if ( !i )
continue ; /* go back to sleep */
else {
OSFreeTimer( USER );
return i;
}
} //while ( TRUE )} /* waitOneMinForKey */