/* * Celestial Fusion * Software for digitized engine data acquisition and processing * * Author: James McCrae */ #include #include #define RESOLUTIONX 640 #define RESOLUTIONY 400 #define TACHBUSADDR 0 #define SPEEDBUSADDR 1 #define NUMINPUTSAMPLES 40 #define NUMINPUTSENSORS 2 /* Class declarations */ class Simulator { public: void update(); private: int state; float rpm; float speed; int gear; long statetransitiontimestamp; }; class Poll { public: void setTimestamp(long timestamp); void setReading(unsigned char reading); long getTimestamp(); unsigned char getReading(); private: long timestamp; unsigned char reading; }; class ParallelPortIO { public: bool IOinit(int portaddress); void setSimulated(bool simulated); unsigned char pollSensor(int busaddress); void resetInputSequence(); private: Poll inputsequence[NUMINPUTSENSORS][NUMINPUTSAMPLES]; int beginindex; bool simulated; }; class GUI { }; /* Function declarations */ void alleg_init(); /* Main Method */ int main(int argc, char ** argv) { //set up environment alleg_init(); //set up parallel port IO ParallelPortIO ppio; //input may be simulated - specified by -S command line parameter if (argc==2) { if (strcmp(argv[1],"-S")==0) { ppio.setSimulated(true); rest(5000); } } BITMAP *doublebuffer=create_bitmap(RESOLUTIONX,RESOLUTIONY); BITMAP *logo=load_pcx("upperlogo.pcx",NULL); BITMAP *optionmenu=load_pcx("optionmenu.pcx",NULL); rest(500); draw_sprite(doublebuffer,logo,0,0); draw_sprite(doublebuffer,optionmenu,50,80); draw_sprite(screen,doublebuffer,0,0); readkey(); return 0; } /* * Sets up keyboard, timer and graphics mode. */ void alleg_init() { if (allegro_init()!=0) { exit(1); } install_timer(); install_keyboard(); set_gfx_mode(GFX_AUTODETECT,RESOLUTIONX,RESOLUTIONY,0,0); } void ParallelPortIO::setSimulated(bool simulated) { this->simulated=simulated; }