[X]关闭

z7芯片,我想给ch23,5640的例程中增加一个中断要怎么加?

文档创建者:扒饭才是硬道理
浏览次数:3741
最后更新:2019-08-10
I2C_config_init();
        Xil_Out32((VDMA_BASEADDR + 0x030), 0x108B);// enable circular mode
                                                Xil_Out32((VDMA_BASEADDR + 0x030), 0x108B);// enable circular mode
                                                Xil_Out32((VDMA_BASEADDR + 0x0AC), VIDEO_BASEADDR0);        // start address
                                                Xil_Out32((VDMA_BASEADDR + 0x0B0), VIDEO_BASEADDR1);        // start address
                                                Xil_Out32((VDMA_BASEADDR + 0x0B4), VIDEO_BASEADDR2);        // start address
                                                Xil_Out32((VDMA_BASEADDR + 0x0A8), (H_STRIDE*3));                // h offset (H_STRIDE* 3) bytes
                                                Xil_Out32((VDMA_BASEADDR + 0x0A4), (H_ACTIVE*3));                // h size (H_ACTIVE * 3) bytes
                                                Xil_Out32((VDMA_BASEADDR + 0x0A0), V_ACTIVE);                        // v size (V_ACTIVE)

                /*****************从DDR读数据设置**********************/
        // Write to discretes register for the specified GPIO channel */
                                while(1){
                                        /*Read state of discretes for the specified GPIO channnel.*/
                                Btn_val=XGpio_DiscreteRead(&Gpio, BTN_CHANNEL);
                        //检测 Btn_val值,如果按钮按下,灯全亮,否则灯全灭
                                if(Btn_val){
                                XGpio_DiscreteWrite(&Gpio, LED_CHANNEL, 0x1);

                                Xil_Out32((VDMA_BASEADDR + 0x000), 0x8B);                 // enable circular mode
                                Xil_Out32((VDMA_BASEADDR + 0x05c), VIDEO_BASEADDR0);         // start address
                                Xil_Out32((VDMA_BASEADDR + 0x060), VIDEO_BASEADDR1);         // start address
                                Xil_Out32((VDMA_BASEADDR + 0x064), VIDEO_BASEADDR2);         // start address
                                Xil_Out32((VDMA_BASEADDR + 0x058), (H_STRIDE*3));                 // h offset (H_STRIDE * 3) bytes
                                Xil_Out32((VDMA_BASEADDR + 0x054), (H_ACTIVE*3));                 // h size (H_ACTIVE * 3) bytes
                                Xil_Out32((VDMA_BASEADDR + 0x050), V_ACTIVE);                         /
想通过按钮来实现视频输入的中断,按钮按下去之后,摄像头开始工作,松开按钮摄像头停止工作,如上增加了if语句之后,摄像头仍是正常工作的。应该把这个if增加到哪里?
观察到这些函数都是一样的?

发表评论已发布 1

uisrc

发表于 2019-8-10 10:10:34 | 显示全部楼层

中断模式建议采用park模式吧,我只做过,没出教程,只能大概提示你下。
越努力越幸运!加油!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则