int main(int args, char **argv) { int v; int i; int first = 1; int k = 2; int period = 10000; long x = get_time(); for(;;){ if(!first){ delay_until(x); mtfd_end(); } mtfd_begin(period); if(!first) actuating(k); v = sensing(); x += period; k = computation(v); first = 0; } // The interesting thing is that the final code // includes to call to pret_mt return k; }
void GAnalogSensor::callback(void) { if(sensing()) { #ifdef CONFIG_GAnalogSensor_DEBUG_AD result_ad = (float) sum / cnt; #endif result = sum * scale; setFlagBits(GAnalogSensor_FLAG_AVAILABLE); reset(); } }
void main(void) { sei(); INIT_IO(); INIT_USART(); INIT_TIMER(); DDRB=0xff; DDRD=0x30; PORTB=0x06; PORTC=0xff; ADMUX=0x60; ADCSRA=0xcc; while(1) { while(calib_flg) { calibration(); } sensing(); Catch_position(); OCR1A=position_R[position]; OCR1B=position_L[position]; } }