#include "display.h" #include "clock.h" #include "logger.h" #include "system.h" #include "signal.h" static void _term_sighandler( int sig ); int main(int argc, char *argv[]) { Size fps, FPS; long timeOld, time; if( e33_set_signal( SIGHUP, _term_sighandler ) == -1 ) { logw( "SIGHUP not handled"); } if( e33_set_signal( SIGINT, _term_sighandler ) == -1 ) { logw( "SIGINT not handled"); } if( e33_set_signal( SIGTERM, _term_sighandler ) == -1 ) { logw( "SIGTERM not handled"); } timeOld = clock_get_us(); time = 0; fps = 0; FPS = 0; if( logger_init() ) { return EXIT_FAILURE; } if( display_init() ) { return EXIT_FAILURE; } while(1) { display_vtswitcher_poll(1); if( __display.active ) { __display.surface.data[10] = GREEN; display_flip(); } time += clock_get_us() - timeOld; timeOld = clock_get_us(); if(time >= 1000000) { logi("FPS: %d", FPS); FPS = fps; time = 0; fps = 0; } ++fps; } display_term(); logger_term(); return EXIT_SUCCESS; } static void _term_sighandler( int sig ) { display_term(); logger_term(); exit(0); }