int shell_continue() { /* * spint_start() returns when either the command has finished, or when * the required interrupt comes in. In the latter case, the appropriate * thing to do is to process the interrupt, and then return to * the interrupt issuer by calling spint_continue(). */ if (need_to_start) { need_to_start = 0; spint_start(command, &spinted); } if (spinted.done == 0) { /* Process request */ handle_api(&spinted.regs, &spinted.sregs); spint_continue(&spinted); } else { char inputbuffer[100]; if (spinted.rc != 0) { fprintf(stderr, "Process generated a return code of 0x%x.\n", spinted.rc); } printf("[Hit return to continue]"); fflush(stdout); (void) gets(inputbuffer); shell_active = 0; setconnmode(); ConnectScreen(); } return shell_active; }
// Timer gboolean timeout_callback(gpointer data) { static unsigned char dispatch = 0; // Only do the settings if in xbee mode if ((power_level >= 0) && (handle_api() == 0)) return TRUE; // Every Time read_port(); // One out of 4 if (dispatch > 2) { send_port(); dispatch = 0; } else { dispatch ++; } return TRUE; }