int main( int, char** ) { try { std::vector< double > result( extractBitratesForTemporalLayers( std::cin ) ); // Extract the bitrate vector // Output the bitrate vector if( 0 < result.size( ) ) { std::vector< double >::const_iterator iter( result.begin( ) ); outputDouble( std::cout, *iter ); for( ; ; ) { ++iter; if( result.end( ) == iter ) { break; } else { std::cout << " "; outputDouble( std::cout, *iter ); } } } return 0; } catch( std::exception& e ) { std::cerr << e.what( ) << std::endl; return 1; } }
void main(void) { /* put your own code here */ unsigned int gX, gY, gZ; double tcX, tcY; double mX, mY, mZ; double mSX, mSY, mSZ; double aX, aY, aZ; double faX = 0; double faY = 0; double faZ = 0; volatile double oldFaX = 0; volatile double oldFaY = 0; volatile double oldFaZ = 0; //ACCEL double pitchDeg, rollDeg, heading, tiltHeading; double pitchRad, rollRad; //DIST unsigned char strDigi[8]; unsigned char strDist[8]; unsigned char strVin[8]; unsigned int i, j, k; unsigned char digiH; unsigned char digiL; double digi, vin, dist, oldDigi; // BMP double temperature; unsigned long pressure; float altSum; float avgAlt; float old; float alt; CLKSEL = 0; SYNR = 2; REFDV = 0; while (!(CRGFLG & 0x08)); CLKSEL = 0x80; // Bus = 24Mhz MCCTL = 0x4C; // PRE = 16 FLMC = 1 EnableInterrupts; // INITIALIZE LCD DDRK = 0xFF; COMWRTFIRST(0x33); //reset sequence provided by data sheet COMWRT(0x32); //reset sequence provided by data sheet COMWRT(0x28); //Function set to four bit data length ,2 line, 5 x 7 dot format COMWRT(0x06); //entry mode set, increment, no shift COMWRT(0x0E); //Display set, disp on, cursor on, blink off COMWRT(0x01); //Clear display COMWRT(0x80); //set start posistion, home position LCDDelayDATA(TCHAR); // wait for LCD setup //********************************************************// // MOTOR Stuff //********************************************************// initializeMotors(); for(i = 0; i < 10; i++) { thrustPOS(1, 10); outputDouble((PWMDTY0 << 8) + PWMDTY1); LCDDelaySCROLL(100); COMWRTFIRST(0x01); LCDDelayDATA(TCHAR); } for(j = 0; j < 10; j++) { thrustNEG(1, 10); outputDouble((PWMDTY0 << 8) + PWMDTY1); LCDDelaySCROLL(100); COMWRTFIRST(0x01); LCDDelayDATA(TCHAR); } /* PWMDTY0 = 0x17; // 1ms PWMDTY1 = 0x70; outputDouble((PWMDTY0 << 8) + PWMDTY1); LCDDelaySCROLL(400); COMWRTFIRST(0x01); LCDDelayDATA(TCHAR); PWMDTY0 = 0x1F; // 1.33ms PWMDTY1 = 0x40; outputDouble((PWMDTY0 << 8) + PWMDTY1); LCDDelaySCROLL(100); COMWRTFIRST(0x01); LCDDelayDATA(TCHAR); PWMDTY0 = 0x27; // 1.65ms PWMDTY1 = 0x10; outputDouble((PWMDTY0 << 8) + PWMDTY1); LCDDelaySCROLL(100); COMWRTFIRST(0x01); LCDDelayDATA(TCHAR); PWMDTY0 = 0x2E; // 2ms PWMDTY1 = 0xE0; outputDouble((PWMDTY0 << 8) + PWMDTY1); LCDDelaySCROLL(100); COMWRTFIRST(0x01); LCDDelayDATA(TCHAR); */ while(1); }
void main(void) { /* put your own code here */ // BMP float altSum; float avgAlt; float old; float alt; int i; CLKSEL = 0; SYNR = 2; REFDV = 0; while (!(CRGFLG & 0x08)); CLKSEL = 0x80; // Bus = 24Mhz MCCTL = 0x4C; // PRE = 16 FLMC = 1 EnableInterrupts; // INITIALIZE LCD DDRK = 0xFF; COMWRTFIRST(0x33); //reset sequence provided by data sheet COMWRT(0x32); //reset sequence provided by data sheet COMWRT(0x28); //Function set to four bit data length ,2 line, 5 x 7 dot format COMWRT(0x06); //entry mode set, increment, no shift COMWRT(0x0E); //Display set, disp on, cursor on, blink off COMWRT(0x01); //Clear display COMWRT(0x80); //set start posistion, home position LCDDelayDATA(TCHAR); // wait for LCD setup //********************************************************// // I2C Stuff //********************************************************// openI2C(BR); LCDDelayDATA(TCHAR); b_setup(); LCDDelayDATA(TCHAR); for(;;) { b_setControlMode(TEMP_MODE); b_updateTempC(); altSum = 0; for(i = 0; i < 5; i++) { b_setControlMode(PRESSURE_MODE_0); b_updatePressure(); b_updateAltitude(); //alt = lpFilter(alt, old, 0.5); altSum+= b_altitude; } avgAlt = altSum/5.0; //old = avgAlt; DATWRTFIRST('T'); outputDouble((double)b_tempC); COMWRTFIRST(0xC0); LCDDelayDATA(TCHAR); DATWRTFIRST('A'); outputDouble((double)b_altitude); LCDDelayDATA(TCHAR * 6); COMWRTFIRST(0x01); LCDDelayDATA(TCHAR); } while(1); }