關於部落格
  • 26536

    累積人氣

  • 1

    今日人氣

    0

    追蹤人氣

lcd週期性on-off.c

/* A example of TCP echo server File : TCPEchoServer.cpp */ #include #include #include #include #include //#include #include #include #include //#include #include #include #include #include #include #include #include #include #include #include //#include #include #include #include "creator_s3c4510_lcd.h" #include "creator_lib.h" #include "creator_lib.c" //#include "lcd-creator.h" #define PROMPT "3 seconds haved been passed" char *prompt=PROMPT; unsigned int len; int fd,i=0,j,ret; /*信號處理函數*/ void prompt_info(int signo) { i++; j=i%2; if(j==1) { printf("no.%d 3secs => LCD onn",i); //write(STDERR_FILENO,prompt,len); ioctl(fd, LCD_IOCTL_POWERON, NULL); LCD_printf(fd,"no.%d LCD onn",i); }else{ printf("no.%d 3secs => LCD sleepn",i); ret =ioctl(fd, LCD_IOCTL_SLP, NULL); } } /*初始化信號*/ void init_sigaction(void) { struct sigaction act; act.sa_handler=prompt_info; act.sa_flags=0; sigemptyset(&act.sa_mask); sigaction(SIGPROF,&act,NULL); } /*初始化程式碼*/ void init_time() { struct itimerval value; /*定時3秒鐘*/ value.it_value.tv_sec=3; value.it_value.tv_usec=0; value.it_interval=value.it_value; setitimer(ITIMER_PROF,&value,NULL); } int main() { fd = open("/dev/lcd", O_RDWR); len=strlen(prompt); init_sigaction(); init_time(); while(1); exit(0); }
相簿設定
標籤設定
相簿狀態