00001 // g++ -g -Wall -I /home/f_plouff/ timer_test.cpp 00002 00003 00004 #ifndef boardTimer_CPP 00005 #define boardTimer_CPP 00006 00007 #include <j2k/Fred/Standard.hpp> 00008 #include <j2k/nto/timer.cpp> 00009 #include <j2k/Fred/Error/JError.cpp> 00010 00011 // 200 ms 00012 #define WAITING 200000000 00013 00014 class timer_test : public my_timer 00015 { 00016 public: 00017 00018 timer_test( ULONG clk = WAITING ) 00019 : my_timer( clk ), val( 0 ), old_val( 0 ) { } 00020 00021 virtual void tick() 00022 { 00023 printf( "#" ); 00024 fflush( stdout ); 00025 00026 old_val = val; 00027 val = b.Read(); 00028 00029 if ( val != old_val ) 00030 b.FastWrite( val ); 00031 00032 } 00033 private: 00034 00035 USHORT val, old_val; 00036 Board b; 00037 timer_test( const timer_test& ); 00038 const timer_test& operator= ( const timer_test& ); 00039 00040 }; 00041 00042 00043 int main() { 00044 timer_test tt( WAITING ); 00045 00046 tt.start(); 00047 00048 for(;;) { // Infinite loop 00049 } 00050 00051 return 0; 00052 } 00053 00054 #endif