#include "framebuffer.hpp" #include #include const unsigned int SECOND = 1000000; Framebuffer fb{"/dev/fb0"}; void exitHandler(int s) { printf("Caught signal %d\n", s); fb.done(); exit(-1); } int main() { if(fb.init() != 0) return -1; struct sigaction sigIntHandler; sigIntHandler.sa_handler = exitHandler; sigemptyset(&sigIntHandler.sa_mask); sigIntHandler.sa_flags = 0; sigaction(SIGINT, &sigIntHandler, NULL); int counter = 0; while(true) { unsigned int color = (counter == 0) ? COLOR_RED : ((counter == 1) ? COLOR_GREEN : COLOR_BLUE); int success = fb.clear(color); if(success != 0) { fb.done(); return -1; } if(counter < 2) counter++; else counter = 0; usleep(SECOND); } fb.done(); return 0; }