/* -------------------------------------------------------------------------- * * Loop around some timer stuff and the i/o multiplexer. * * -------------------------------------------------------------------------- */ void servauth_loop(void) { int ret = 0; int64_t *timeout; int64_t remain = 0LL; while(ret >= 0) { /* Calculate timeout value */ timeout = timer_timeout(); /* Do I/O multiplexing and event handling */ #ifdef USE_POLL ret = io_poll(&remain, timeout); #else ret = io_select(&remain, timeout); #endif /* Remaining time is 0msecs, we need to run a timer */ if(remain == 0LL) timer_run(); if(timeout) timer_drift(*timeout - remain); io_handle(); } }
void io_cycle() { for(uint8_t cycle = 0; cycle < 8; cycle++) { io_select(cycle); uint8_t n, v; // first chip of first parameter board n = parameter_map[cycle].mapping; v = io_read_parameter(0); if(parameter_map[cycle].invert) v = 255 - v; parameter[n] = v; // first chip of first parameter board n = parameter_map[cycle+8].mapping; v = io_read_parameter(1); if(parameter_map[cycle+8].invert) v = 255 - v; parameter[n] = v; } }
void sploit_loop(void) { int ret = 0; int64_t *timeout; int64_t remain = 0LL; while(ret >= 0) { /* Calculate timeout value */ timeout = timer_timeout(); /* Do I/O multiplexing and event handling */ #if (defined USE_SELECT) ret = io_select(&remain, timeout); #elif (defined USE_POLL) ret = io_poll(&remain, timeout); #endif /* Remaining time is 0msecs, we need to run a timer */ if(remain == 0LL) timer_run(); if(timeout) timer_drift(*timeout - remain); io_handle(); timer_collect(); /* ircd_collect();*/ } }
/* * Die Peripherie mit dem internen Zustand synchronisieren */ void io_sync(void) { // Sync-Timer-Led umschalten TOGGLEBIT(TIMER_PORT, TIMER_PIN); // Alle 8 Multiplexer-Zustände ablaufen for(uint8_t cycle = 0; cycle < 8; cycle++) { // Tastendrücke und Rad-Drehung detektieren // TODO: ggf. aus dem loop rausnehmen io_selector_detect(); // Sequencer Leds ausschalten io_sequencer_presync(cycle); // Multiplexer umschalten io_select(cycle); // Sequencer Leds ggf. wieder an schalten und und Taster detektieren io_sequencer_sync(cycle); // Werte der Parameter-Boards auslesen io_parameter_sync(cycle); } }