• LCD控制实验—孟明明


    09计应一班 孟明明 LCD控制实验

    #include
    #include
    #include

    #include      // open() close()
    #include     // read() write()


    #define DEVICE_NAME "/dev/fb0"

    #define VERSION         "PXA270RP-LCD-V1.00-090101"

    void showversion(void)
    {
            printf
    ("********************************************* ");
            printf
    (" %s ", VERSION);
            printf
    ("********************************************* ");

    }

    //------------------------------------- main ----------------------------------------------------------------
    int main(void)
    {
           
    int fd;
           
    int ret;
           
    int i;
           
    int j;
           
    int f=0;
           
    int k=0;
           
    unsigned short buf[480][800];

            showversion
    ();

            printf
    (" start test_lcd test ");

            fd
    = open(DEVICE_NAME, O_RDWR);
           
            printf
    ("fd = %d ",fd);
           

           
    if (fd == -1)
           
    {
                    printf
    ("open device %s error ",DEVICE_NAME);
           
    }
           
    else
           
    {
                                           
                           
    for(i=0;i<480;i++){
                                   
    for(j=0;j<800;j++){
                           
                                    buf
    [i][j]=0x0001;
                                   
    }
                           
    }
                            ret
    =write(fd,buf,sizeof(buf));

                            usleep
    (500000);
                            close
    (fd);
                   
    //----------------------------------------------
                           
    while(1){                       //设置一个方块中嵌套方块的图片并向四周同时扩散
                                                           
    //也可将循环过程封装成一个函数,进行函数回调,效果会更好!

                            fd
    = open(DEVICE_NAME, O_RDWR);
                           
                           
    for(i=0;i<480;i++){
                                   
    for(j=0;j<f;j++){
                                    buf
    [i][j]=0x0001;
                                   
                           
    }
                           
                           
    }
                            ret
    =write(fd,buf,sizeof(buf));

                           
    //usleep(500000);
                            close
    (fd);
                            fd
    = open(DEVICE_NAME, O_RDWR);
                           
    for(i=200-f;i<280+f;i++){
                                   
    for(j=340-k;j<460+k;j++){
                                            buf
    [i][j]=0xf800;
                                                   
    }                      
                                           
    }
                           
    for(i=220-f;i<260+f;i++){
                                           
    for(j=370-k;j<430+k;j++){
                                            buf
    [i][j]=0x0001;
                                   
    }
                           
    }
                           
    for(i=240-f;i<240+f;i++){
                                           
    for(j=400-k;j<400+k;j++){
                                            buf
    [i][j]=0xf81f;
                                   
    }
                           
    }

                            f
    =f+8;
                            k
    =k+12;
                            ret
    =write(fd,buf,sizeof(buf));
                            usleep
    (100000);
                            close
    (fd);
                           
                           
                           
    if(f>=200||k>=340){
                                                   
                           
    for(i=0;i<480;i++){
                                   
    for(j=0;j<800;j++){
                           
                                    buf
    [i][j]=0x0001;
                                           
    }                      
                                   
    }
                                    f
    =0;
                                    k
    =0;
                                   
    }
                           
    }
                           
                           
    if(getchar()>0){
                       
                            system
    ("cat fb >/dev/fb0");
                            system
    ("cat apl_test/fb >/dev/fb0");
                                         
    }
         
           
    }

           
    return 0;
    }// end main

    <script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
    阅读(575) | 评论(0) | 转发(0) |
    给主人留下些什么吧!~~
    评论热议
  • 相关阅读:
    AOD.net
    C# Eval()和Bind()
    .Net使用微軟自帶的用戶驗證和登錄授權
    .Net面試4套
    .Net面試題
    MVC开发模式
    .Net自帶Ajax和GridView
    HTML系列(HTMl+CSS+JavaScript+Jquery)--un
    .Net母版页
    .NetDOM操作--un
  • 原文地址:https://www.cnblogs.com/ztguang/p/12647399.html
Copyright © 2020-2023  润新知