[Kinetis] 【FRDM-K64F开发笔记】FRDM图像采集及显示

[复制链接]
2169|7
 楼主| E-Kaia 发表于 2016-1-23 21:27 | 显示全部楼层 |阅读模式
在申请FRDM-K64时提到了对图像的采集,随着对飞思卡尔M4平台的学习,现在一个简单的图像采集完全不在话下,本demo采用KSDK编写,主要涉及到的接口有SCCB和SPI以及一个摄像头的并口,利用FRDM-K64上的DSPI驱动一个串口显示屏用于显示,虽然SCCB是一个类似于I2C的接口,但是在便于移植的前提下没有采用FRAM-K64上的硬件I2C接口,而直接使用模拟I2C,在摄像头8位的并口方面由于没有在FRDM-K64上找到连续的8位GPIO,所以只能选择同一PORT上的两个连续的四位进行拼接,这样大大降低了摄像头采集时的速度,主要接口连线如下
PTD6<-------------->MOSI
PTD7<-------------->MISO(部分串口屏可以不接)
PTD5<-------------->MCLK
PTD4<-------------->CS
PTB20<-------------->RS
PTC18<-------------->BL
PTC16<-------------->WE
PTC17<-------------->WRST
PTB9<-------------->VSYNC
PTA1<-------------->RCLK
PTB23<-------------->PRST
PTA2<-------------->OE
PTC0<-------------->DB0
PTC1<-------------->DB1
PTC2<-------------->DB2
PTC3<-------------->DB3
PTC8<-------------->DB4
PTC9<-------------->DB5
PTC10<-------------->DB6
PTC11<-------------->DB7
PTC15<-------------->SCK
PTC14<-------------->SDA
       以上是所有的接口连线,使用的摄像头是OV7725,主要是通过SCCB对摄像头进行配置,配置相关寄存器(和LCD的初始化类似),由于我的显示屏是176*240这种奇葩的分辨率,所以我将OV7725设置成输出176*240分辨率的RGB数据,然后按照一定时序进行采集,这个OV7725摄像头上带有FIFO,话说如果FIFO没有的话估计M4也无法采集,貌似飞思卡尔的K64没有摄像头接口。
       而LCD驱动方面主要通过K64的DSPI,上篇帖子具体讲了KSDK编写的DSPI驱动FLASH的方法,本文就不再多讲,只要将驱动FLASH的底层函数简单的改一下就行了(主要是FLASH可读可写,我这个LCD是只能写不能读的),实际LCD驱动好后只有大概9FPS,相当慢的速度了,DSPI还是使用的最高速度30M,然而效果只有这样,估计是我这块LCD的瓶颈了吧。
       在图像采集时由于对数据进行了移位拼接大大降低了采集速度,本身可以达到的60FPS的采集速度在K64上也就只能实现9FPS,再加上龟速的显示最终效果只有5FPS,不尽人意,但是对飞思卡尔K64平台的学习也是挺好的。

由于FRDM上都是排插,而杜邦线也是排插,只能在排插上接上排针进行连接,这样连接同时降低了系统的稳定性,图像也出现了一点小瑕疵,不过也没有办法,毕竟没有公母头的排线。桌子比较乱见谅了,附件是完整的采集显示程序,主要还是IAR平台的keil下没有搞。
 楼主| E-Kaia 发表于 2016-1-23 21:30 | 显示全部楼层
  1. #include "ov7725.h"
  2. #include "spi_lcd.h"
  3. #include "sccb.h"
  4. #include "delay.h"
  5. OV7725_IDTypeDef OV7725ID;
  6. u8 ov_sta,ov_frame;
  7. extern uint32_t count;
  8. #define CAMERA_H 120
  9. #define CAMERA_W 160
  10. /* 寄存器参数配置 */
  11. typedef struct Reg
  12. {
  13.   uint8_t Address;                               /*寄存器地址*/
  14.   uint8_t Value;                           /*寄存器值*/
  15. }Reg_Info;
  16. Reg_Info Sensor_Config1[] =
  17. {
  18.   {OV7725_CLKRC,     0x00}, /*clock config*/
  19.   {OV7725_COM7,      0x46}, /*QVGA RGB565 */
  20.   {OV7725_HSTART,    0x3f},
  21.   {OV7725_HSIZE,     0x50},
  22.   {OV7725_VSTRT,     0x03},
  23.   {OV7725_VSIZE,     0x78},
  24.   {OV7725_HREF,      0x00},
  25.   {OV7725_HOutSize,  0x2c},
  26.   {OV7725_VOutSize,  0x78},
  27.   {OV7725_EXHCH,     0x00},
  28.   
  29.   /*DSP control*/
  30.   {OV7725_TGT_B,     0x7f},
  31.   {OV7725_FixGain,   0x09},
  32.   {OV7725_AWB_Ctrl0, 0xe0},
  33.   {OV7725_DSP_Ctrl1, 0xff},
  34.   {OV7725_DSP_Ctrl2, 0x20},
  35.   {OV7725_DSP_Ctrl3,        0x00},
  36.   {OV7725_DSP_Ctrl4, 0x00},
  37.   
  38.   /*AGC AEC AWB*/
  39.   {OV7725_COM8,                  0xf0},
  40.   {OV7725_COM4,                  0x81}, /*Pll AEC CONFIG*/
  41.   {OV7725_COM6,                  0xc5},
  42.   {OV7725_COM9,                  0x21},
  43.   {OV7725_BDBase,          0xFF},
  44.   {OV7725_BDMStep,          0x01},
  45.   {OV7725_AEW,                    0x34},
  46.   {OV7725_AEB,                    0x3c},
  47.   {OV7725_VPT,                    0xa1},
  48.   {OV7725_EXHCL,                  0x00},
  49.   {OV7725_AWBCtrl3,  0xaa},
  50.   {OV7725_COM8,                  0xff},
  51.   {OV7725_AWBCtrl1,  0x5d},
  52.   
  53.   {OV7725_EDGE1,                  0x0a},
  54.   {OV7725_DNSOff,          0x01},
  55.   {OV7725_EDGE2,                  0x01},
  56.   {OV7725_EDGE3,                  0x01},
  57.   
  58.   {OV7725_MTX1,                  0x5f},
  59.   {OV7725_MTX2,                  0x53},
  60.   {OV7725_MTX3,                  0x11},
  61.   {OV7725_MTX4,                  0x1a},
  62.   {OV7725_MTX5,                  0x3d},
  63.   {OV7725_MTX6,                  0x5a},
  64.   {OV7725_MTX_Ctrl,  0x1e},
  65.   
  66.   {OV7725_BRIGHT,          0x00},
  67.   {OV7725_CNST,                  0x25},
  68.   {OV7725_USAT,                  0x65},
  69.   {OV7725_VSAT,                  0x65},
  70.   {OV7725_UVADJ0,          0x81},
  71.   {OV7725_SDE,                    0x06},
  72.   
  73.   /*GAMMA config*/
  74.   {OV7725_GAM1,                  0x0c},
  75.   {OV7725_GAM2,                  0x16},
  76.   {OV7725_GAM3,                  0x2a},
  77.   {OV7725_GAM4,                  0x4e},
  78.   {OV7725_GAM5,                  0x61},
  79.   {OV7725_GAM6,                  0x6f},
  80.   {OV7725_GAM7,                  0x7b},
  81.   {OV7725_GAM8,                  0x86},
  82.   {OV7725_GAM9,                  0x8e},
  83.   {OV7725_GAM10,                  0x97},
  84.   {OV7725_GAM11,                  0xa4},
  85.   {OV7725_GAM12,                  0xaf},
  86.   {OV7725_GAM13,                  0xc5},
  87.   {OV7725_GAM14,                  0xd7},
  88.   {OV7725_GAM15,                  0xe8},
  89.   {OV7725_SLOP,                  0x20},
  90.   
  91.   {OV7725_HUECOS,          0x80},
  92.   {OV7725_HUESIN,          0x80},
  93.   {OV7725_DSPAuto,          0xff},
  94.   {OV7725_DM_LNL,          0x00},
  95.   {OV7725_BDBase,          0x99},
  96.   {OV7725_BDMStep,          0x03},
  97.   {OV7725_LC_RADI,          0x00},
  98.   {OV7725_LC_COEF,          0x13},
  99.   {OV7725_LC_XC,                  0x08},
  100.   {OV7725_LC_COEFB,  0x14},
  101.   {OV7725_LC_COEFR,  0x17},
  102.   {OV7725_LC_CTR,          0x05},
  103.   
  104.   {OV7725_COM3,                  0xd0},/*Horizontal mirror image*/
  105.   
  106.   /*night mode auto frame rate control*/
  107.   {OV7725_COM5,                0xf5},         /*?úò1êó?·?3??£?×??ˉ?μμí???ê£?±£?¤μí???è?-???êá?*/
  108.   //{COM5,                0x31},        /*ò1êó?·?3???ê2?±?*/
  109. };
  110. /*OV7725初始化配置表*/
  111. Reg_Info Sensor_Config[] =
  112. {
  113.   //寄存器,寄存器值次
  114.   {OV7725_COM4         , 0xC1},
  115.   {OV7725_CLKRC        , 0x00},
  116.   {OV7725_COM2         , 0x03},
  117.   {OV7725_COM3         , 0xD0},
  118.   {OV7725_COM7         , 0x40},
  119.   {OV7725_HSTART       , 0x3F},
  120.   {OV7725_HSIZE        , 0x50},
  121.   {OV7725_VSTRT        , 0x03},
  122.   {OV7725_VSIZE        , 0x78},
  123.   {OV7725_HREF         , 0x00},
  124.   {OV7725_SCAL0        , 0x0A},
  125.   {OV7725_AWB_Ctrl0    , 0xE0},
  126.   {OV7725_DSPAuto      , 0xff},
  127.   {OV7725_DSP_Ctrl2    , 0x0C},
  128.   {OV7725_DSP_Ctrl3    , 0x00},
  129.   {OV7725_DSP_Ctrl4    , 0x00},
  130.   
  131. #if (CAMERA_W == 80)
  132.   {OV7725_HOutSize     , 0x14},
  133. #elif (CAMERA_W == 160)
  134.   {OV7725_HOutSize     , 0x28},
  135. #elif (CAMERA_W == 240)
  136.   {OV7725_HOutSize     , 0x3c},
  137. #elif (CAMERA_W == 320)
  138.   {OV7725_HOutSize     , 0x50},
  139. #else
  140.   
  141. #endif
  142.   
  143. #if (CAMERA_H == 60 )
  144.   {OV7725_VOutSize     , 0x1E},
  145. #elif (CAMERA_H == 120 )
  146.   {OV7725_VOutSize     , 0x3c},
  147. #elif (CAMERA_H == 180 )
  148.   {OV7725_VOutSize     , 0x5a},
  149. #elif (CAMERA_H == 240 )
  150.   {OV7725_VOutSize     , 0x78},
  151. #else
  152.   
  153. #endif
  154.   
  155.   {OV7725_EXHCH        , 0x00},
  156.   {OV7725_GAM1         , 0x0c},
  157.   {OV7725_GAM2         , 0x16},
  158.   {OV7725_GAM3         , 0x2a},
  159.   {OV7725_GAM4         , 0x4e},
  160.   {OV7725_GAM5         , 0x61},
  161.   {OV7725_GAM6         , 0x6f},
  162.   {OV7725_GAM7         , 0x7b},
  163.   {OV7725_GAM8         , 0x86},
  164.   {OV7725_GAM9         , 0x8e},
  165.   {OV7725_GAM10        , 0x97},
  166.   {OV7725_GAM11        , 0xa4},
  167.   {OV7725_GAM12        , 0xaf},
  168.   {OV7725_GAM13        , 0xc5},
  169.   {OV7725_GAM14        , 0xd7},
  170.   {OV7725_GAM15        , 0xe8},
  171.   {OV7725_SLOP         , 0x20},
  172.   {OV7725_LC_RADI      , 0x00},
  173.   {OV7725_LC_COEF      , 0x13},
  174.   {OV7725_LC_XC        , 0x08},
  175.   {OV7725_LC_COEFB     , 0x14},
  176.   {OV7725_LC_COEFR     , 0x17},
  177.   {OV7725_LC_CTR       , 0x05},
  178.   {OV7725_BDBase       , 0x99},
  179.   {OV7725_BDMStep      , 0x03},
  180.   {OV7725_SDE          , 0x04},
  181.   {OV7725_BRIGHT       , 0x00},
  182.   {OV7725_CNST         , 0xFF},
  183.   {OV7725_SIGN         , 0x06},
  184.   {OV7725_UVADJ0       , 0x11},
  185.   {OV7725_UVADJ1       , 0x02},
  186.   
  187. };

  188. u8 OV7725_REG_NUM = sizeof(Sensor_Config)/sizeof(Sensor_Config[0]);          /*结构体数组成员数目*/
  189. u8 OV7725_REG_NUM1= sizeof(Sensor_Config1)/sizeof(Sensor_Config1[0]);
  190. uint8_t Ov7725_vsync = 0;         /* 帧同步信号标志,在中断函数和main函数里面使用 */
  191. void OV7725_GPIO_Init(void)
  192. {
  193.   uint8_t i=0;
  194. const gpio_output_pin_user_config_t sccb_gpio_config[]=
  195.   {
  196.     {.pinName = GPIO_MAKE_PIN(GPIOC_IDX, 16U),
  197.     .config.outputLogic = 1,
  198.     .config.slewRate = kPortFastSlewRate,
  199.     .config.isOpenDrainEnabled = false,
  200.     .config.driveStrength = kPortHighDriveStrength,
  201.     },                                                                       //PTC16 WE
  202.     {.pinName = GPIO_MAKE_PIN(GPIOC_IDX, 17U),
  203.     .config.outputLogic = 1,
  204.     .config.slewRate = kPortFastSlewRate,
  205.     .config.isOpenDrainEnabled = false,
  206.     .config.driveStrength = kPortHighDriveStrength,
  207.     },                                                                       //PTC17 WRST
  208.     {.pinName = GPIO_MAKE_PIN(GPIOA_IDX, 1U),
  209.     .config.outputLogic = 1,
  210.     .config.slewRate = kPortFastSlewRate,
  211.     .config.isOpenDrainEnabled = false,
  212.     .config.driveStrength = kPortHighDriveStrength,
  213.     },                                                                       //PTA1 RCLK
  214.     {.pinName = GPIO_MAKE_PIN(GPIOB_IDX, 23U),
  215.     .config.outputLogic = 1,
  216.     .config.slewRate = kPortFastSlewRate,
  217.     .config.isOpenDrainEnabled = false,
  218.     .config.driveStrength = kPortHighDriveStrength,
  219.     },                                                                       //PTB23 PRST
  220.     {.pinName = GPIO_MAKE_PIN(GPIOA_IDX, 2U),
  221.     .config.outputLogic = 1,
  222.     .config.slewRate = kPortFastSlewRate,
  223.     .config.isOpenDrainEnabled = false,
  224.     .config.driveStrength = kPortHighDriveStrength,
  225.     },                                                                       //PTA2 OE
  226.    
  227.   };
 楼主| E-Kaia 发表于 2016-1-23 21:31 | 显示全部楼层
  1. for(i=0;i<5;i++)
  2. GPIO_DRV_OutputPinInit(&sccb_gpio_config[i]);

  3.   //GPIO_DRV_OutputPinInit(&sccb_gpio_config[0]);
  4.   const gpio_input_pin_user_config_t VSYNC_Pin =
  5.   {
  6.     .pinName = GPIO_MAKE_PIN(GPIOB_IDX, 9U),
  7.     .config.isPullEnable = true,
  8.     .config.pullSelect = kPortPullUp,
  9.     .config.isPassiveFilterEnabled = false,
  10.     .config.interrupt = kPortIntFallingEdge
  11.   };
  12.   const gpio_input_pin_user_config_t DATA_Pin[] =
  13.   {
  14.     {
  15.     .pinName = GPIO_MAKE_PIN(GPIOC_IDX, 0U),
  16.     .config.isPullEnable = true,
  17.     .config.pullSelect = kPortPullUp,
  18.     .config.isPassiveFilterEnabled = false,
  19.     .config.interrupt = kPortIntDisabled,
  20.     },
  21.      {
  22.     .pinName = GPIO_MAKE_PIN(GPIOC_IDX, 1U),
  23.     .config.isPullEnable = true,
  24.     .config.pullSelect = kPortPullUp,
  25.     .config.isPassiveFilterEnabled = false,
  26.     .config.interrupt = kPortIntDisabled,
  27.     },
  28.      {
  29.     .pinName = GPIO_MAKE_PIN(GPIOC_IDX, 2U),
  30.     .config.isPullEnable = true,
  31.     .config.pullSelect = kPortPullUp,
  32.     .config.isPassiveFilterEnabled = false,
  33.     .config.interrupt = kPortIntDisabled,
  34.     },
  35.      {
  36.     .pinName = GPIO_MAKE_PIN(GPIOC_IDX, 3U),
  37.     .config.isPullEnable = true,
  38.     .config.pullSelect = kPortPullUp,
  39.     .config.isPassiveFilterEnabled = false,
  40.     .config.interrupt = kPortIntDisabled,
  41.     },
  42.    
  43.      {
  44.     .pinName = GPIO_MAKE_PIN(GPIOC_IDX, 8U),
  45.     .config.isPullEnable = true,
  46.     .config.pullSelect = kPortPullUp,
  47.     .config.isPassiveFilterEnabled = false,
  48.     .config.interrupt = kPortIntDisabled,
  49.     },
  50.      {
  51.     .pinName = GPIO_MAKE_PIN(GPIOC_IDX, 9U),
  52.     .config.isPullEnable = true,
  53.     .config.pullSelect = kPortPullUp,
  54.     .config.isPassiveFilterEnabled = false,
  55.     .config.interrupt = kPortIntDisabled,
  56.     },
  57.      {
  58.     .pinName = GPIO_MAKE_PIN(GPIOC_IDX, 10U),
  59.     .config.isPullEnable = true,
  60.     .config.pullSelect = kPortPullUp,
  61.     .config.isPassiveFilterEnabled = false,
  62.     .config.interrupt = kPortIntDisabled,
  63.     },
  64.      {
  65.     .pinName = GPIO_MAKE_PIN(GPIOC_IDX, 11U),
  66.     .config.isPullEnable = true,
  67.     .config.pullSelect = kPortPullUp,
  68.     .config.isPassiveFilterEnabled = false,
  69.     .config.interrupt = kPortIntDisabled,
  70.     },
  71.   };

  72.   for(i=0;i<8;i++)
  73.   {
  74.     GPIO_DRV_InputPinInit(&DATA_Pin[i]);
  75.   }
  76.    GPIO_DRV_InputPinInit(&VSYNC_Pin);
  77.    NVIC_DisableIRQ(PORTB_IRQn);
  78. }
  79. void OV7725_Init(void)
  80. {
  81.   
  82.   SCCB_Init();
  83.   OV7725_GPIO_Init();
  84.   OV7725_ReadID(&OV7725ID);  //重要环节,使用OV7725要先看看读取ID正不正常
  85.   OV7725_config();   //配置JPEG参数
  86.   NVIC_EnableIRQ(PORTB_IRQn);
  87.   
  88. }

  89. uint8_t OV7725_ReadID(OV7725_IDTypeDef* OV7725ID)
  90. {
  91.   if(SCCB_WR_Reg(OV7725_COM7, 0x80)) return 1;
  92.   
  93.   
  94.   OV7725ID->Manufacturer_IDH =SCCB_RD_Reg(OV7725_MIDH);
  95.   
  96.   OV7725ID->Manufacturer_IDL =SCCB_RD_Reg(OV7725_MIDL);
  97.   
  98.   OV7725ID->Version =SCCB_RD_Reg(OV7725_VER);
  99.   
  100.   OV7725ID->PID =SCCB_RD_Reg(OV7725_PID);
  101.   
  102.   return 0;
  103. }



  104. void OV7725_config(void)
  105. {
  106.   uint8_t i=0;
  107.   if(OV7725ID.Version == 0x21)
  108.   {
  109.     for( i = 0 ; i < OV7725_REG_NUM1 ; i++ )
  110.     {
  111.       SCCB_WR_Reg(Sensor_Config1[i].Address, Sensor_Config1[i].Value);
  112.       delay_ms(2);
  113.     }
  114.   }
  115.   
  116. }
  117. void PORTB_IRQHandler(void)
  118. {
  119.     // Clear external interrupt flag.
  120.   if(GPIO_DRV_IsPinIntPending(GPIO_MAKE_PIN(GPIOB_IDX, 9U)))
  121.   {
  122.         if(ov_sta<2)
  123.     {
  124.       if(ov_sta==0)
  125.       {
  126.         FIFO_WRST_L();                                            
  127.         FIFO_WRST_H();       
  128.         FIFO_WE_H();       
  129.       }else
  130.       {
  131.         FIFO_WE_L();       
  132.       }         
  133.       ov_sta++;
  134.     }
  135.     GPIO_DRV_ClearPinIntFlag(GPIO_MAKE_PIN(GPIOB_IDX, 9U));
  136.   }
  137. }
  138. //void EXTI15_10_IRQHandler(uint16_t GPIO_Pin)
  139. //{
  140. //  if(EXTI_GetITStatus(EXTI_Line10) != RESET)
  141. //  {
  142. //    if(ov_sta<2)
  143. //    {
  144. //      if(ov_sta==0)
  145. //      {
  146. //        FIFO_WRST_L();                                            
  147. //        FIFO_WRST_H();       
  148. //        FIFO_WE_H();       
  149. //      }else
  150. //      {
  151. //        FIFO_WE_L();       
  152. //      }         
  153. //      ov_sta++;
  154. //    }
  155.    
  156. //  }
  157. //  EXTI_ClearITPendingBit(EXTI_Line10); //清除LINE0上的中断标志位
  158. //}

  159. void camera_refresh(void)
  160. {
  161.   u32 i,j;
  162.   u16 color,temp;
  163.   if(ov_sta==2)
  164.   {
  165.      NVIC_DisableIRQ(PORTB_IRQn);
  166.     FIFO_OE_L();         
  167.     FIFO_RRST_L();                                //开始复位读指针
  168.     FIFO_RCLK_L();
  169.     FIFO_RCLK_H();
  170.     FIFO_RCLK_L();
  171.     FIFO_RRST_H();                                //复位读指针结束
  172.     FIFO_RCLK_H();
  173.     count=0;
  174.     for(i=0;i<176;i++)
  175.     {
  176.       for(j=0;j<240;j++)
  177.       {
  178.         FIFO_RCLK_L();
  179.         //temp=PTC->PDIR;
  180.         color=OV7725_DATA;
  181.         FIFO_RCLK_H();
  182.       
  183. //        color=(temp>>4|temp)&0xff;       
  184.         color<<=8;                                          
  185.         FIFO_RCLK_L();
  186.         color|=OV7725_DATA;
  187.         //temp=PTC->PDIR;  
  188.         FIFO_RCLK_H();        
  189.         //color|=(temp>>4|temp)&0xff;                //读数据
  190.        
  191.         SPILCD_WriteRAM(color);                            
  192.       }  
  193.     }
  194.     PRINTF("DISP TIME IS %d ms\r\n",count);
  195.     FIFO_OE_H();                                                          
  196.     FIFO_RCLK_L();
  197.     FIFO_RCLK_H();                
  198.     ov_sta=0;                                        //开始下一次采集
  199.     ov_frame++;
  200. GPIO_DRV_ClearPinIntFlag(GPIO_MAKE_PIN(GPIOB_IDX, 9U)); //清除LINE0上的中断标志位
  201.     NVIC_EnableIRQ(PORTB_IRQn);
  202.   }   
  203. }         
 楼主| E-Kaia 发表于 2016-1-23 21:31 | 显示全部楼层
  1. //-----------------------------------------------------------------------
  2. // KSDK Includes
  3. //-----------------------------------------------------------------------
  4. #include "board.h"
  5. #include "pin_mux.h"
  6. #include "fsl_clock_manager.h"
  7. #include "fsl_debug_console.h"
  8. //-----------------------------------------------------------------------
  9. // Hardware Initialization
  10. //-----------------------------------------------------------------------
  11. void hardware_init(void)
  12. {

  13.     /* enable clock for PORTs */
  14.     CLOCK_SYS_EnablePortClock(PORTA_IDX);
  15.     CLOCK_SYS_EnablePortClock(PORTB_IDX);
  16.     CLOCK_SYS_EnablePortClock(PORTC_IDX);
  17.     CLOCK_SYS_EnablePortClock(PORTD_IDX);
  18.     CLOCK_SYS_EnablePortClock(PORTE_IDX);

  19.     /* Init board clock */
  20.     BOARD_ClockInit();
  21. }
 楼主| E-Kaia 发表于 2016-1-23 21:33 | 显示全部楼层
  1. #include <stdio.h>
  2. //-----------------------------------------------------------------------
  3. // KSDK Includes
  4. //-----------------------------------------------------------------------
  5. #include "main.h"
  6. #include "pit.h"
  7. #include "delay.h"
  8. #include "spi_lcd.h"
  9. #include "ov7725.h"
  10. //-----------------------------------------------------------------------
  11. // Application Includes
  12. //-----------------------------------------------------------------------

  13. //-----------------------------------------------------------------------
  14. // Function Prototypes
  15. //-----------------------------------------------------------------------

  16. //-----------------------------------------------------------------------
  17. // Constants
  18. //-----------------------------------------------------------------------

  19. //-----------------------------------------------------------------------
  20. // Typedefs
  21. //-----------------------------------------------------------------------

  22. //-----------------------------------------------------------------------
  23. // Global Variables
  24. //-----------------------------------------------------------------------

  25. //-----------------------------------------------------------------------
  26. // Macros
  27. //-----------------------------------------------------------------------

  28. //-----------------------------------------------------------------------
  29. // Main Function
  30. //-----------------------------------------------------------------------
  31. extern uint32_t count;

  32. int main(void)
  33. {

  34.     // Configure board specific pin muxing
  35.   uint32_t temp;
  36.     hardware_init();
  37.     delay_init(120);
  38.     // Initialize UART terminal
  39.     dbg_uart_init();

  40.     PRINTF("\r\nRunning the Demo project.\r\n");
  41.     LED1_EN;
  42.     LED2_EN;
  43.     LED3_EN;
  44.     PIT_Init(0,true,1000);
  45.     LCD_Init();
  46.     LCD_Set_Dir(DFT_SCAN_DIR);
  47.   SPILCD_Clear(BLUE);
  48.   SPILCD_SetWindow(0,175,0,240);     //开始写入GRAM       
  49.   OV7725_Init();
  50.    
  51.     //LCD_ShowString();
  52.     for (;;)                                         // Forever loop
  53.     {
  54. //      LED1_TOGGLE;
  55. //      delay_ms(500);
  56. //      count=0;
  57. //      SPILCD_Clear(RED);
  58. //      temp=count;
  59. //      printf("LCD clear time is %d ms\r\n",temp);
  60. camera_refresh();
  61.     }


  62. }
lll6711 发表于 2016-1-23 23:53 | 显示全部楼层
多谢分享
大秦正声 发表于 2016-1-24 08:44 来自手机 | 显示全部楼层
justinlin2015 发表于 2016-1-25 17:38 | 显示全部楼层
多谢分享
您需要登录后才可以回帖 登录 | 注册

本版积分规则

15

主题

100

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部