Port of TI's CC3100 Websock camera demo. Using FreeRTOS, mbedTLS, also parts of Arducam for cams ov5642 and 0v2640. Can also use MT9D111. Work in progress. Be warned some parts maybe a bit flacky. This is for Seeed Arch max only, for an M3, see the demo for CM3 using the 0v5642 aducam mini.
Diff: camera_app/camera_app.cpp
- Revision:
- 1:1a80c1529aa3
- Parent:
- 0:50cedd586816
- Child:
- 2:b92db44a29b4
--- a/camera_app/camera_app.cpp Wed Jun 24 09:54:16 2015 +0000 +++ b/camera_app/camera_app.cpp Thu Jun 25 18:37:49 2015 +0000 @@ -347,67 +347,29 @@ static unsigned short CaptureImage(char** WriteBuffer) { Uart_Write((uint8_t*)"CaptureImage \n\r"); + DCMI_HandleTypeDef hdcmi; + DMA_HandleTypeDef hdma_dcmi; // // Configure DMA in ping-pong mode // DMAConfig(); -//uint32_t addr; -//uint16_t length; - -//addr = (uint32_t) image->pixels; -//length = MAX_XFER_SIZE; - -/* Start the DCMI */ -//HAL_DCMI_Start_DMA(&DCMIHandle, -// DCMI_MODE_SNAPSHOT, addr, length); + HAL_DCMI_Start_DMA(&hdcmi, DCMI_MODE_SNAPSHOT, (uint32_t)&WriteBuffer, FRAME_SIZE_IN_BYTES); + /* Wait for frame */ -//while ((DCMI->CR & DCMI_CR_CAPTURE) != 0) { +while ((DCMI->CR & DCMI_CR_CAPTURE) != 0) { -//} +} /* The frame is finished, but DMA still waiting for data because we set max frame size so we need to abort the DMA transfer here */ -//HAL_DMA_Abort(&DMAHandle); +HAL_DMA_Abort(&hdma_dcmi); /* Read the number of data items transferred */ -//image->size = (MAX_XFER_SIZE - DMAHandle.Instance->NDTR)*4; - -/** - * @brief Configures the MCO Module - * @param None - * @retval None - */ -/* -void OV9655_MCO_Configuration(void){ - GPIO_InitTypeDef GPIO_InitStructure; - - RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE); - - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; - GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; - GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; - GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; - GPIO_Init(GPIOC, &GPIO_InitStructure); - - GPIO_PinAFConfig(GPIOC, GPIO_PinSource7, GPIO_AF_MCO); - - RCC_PLLI2SCmd(DISABLE); - - RCC_PLLI2SConfig(240, 5); // 192..432, 2..7, ie range of 27.429 Mhz to 192 MHz - // PLLI2SSCLK = 240 / 5 = 48Mhz - // MCO2 Output Freq = 48 / 2 = 24Mhz - RCC_MCO2Config(RCC_MCO2Source_PLLI2SCLK, RCC_MCO2Div_2); // 24 MHz with default PLL fComp - - RCC_PLLI2SCmd(ENABLE); - - while(RCC_GetFlagStatus(RCC_FLAG_PLLI2SRDY) == RESET); -} -*/ +//image->size = (FRAME_SIZE_IN_BYTES - hdma_dcmi.Instance->NDTR)*4; // // Perform Image Capture @@ -577,6 +539,8 @@ static void CameraIntHandler() { Uart_Write((uint8_t*)"CameraIntHandler \n\r"); + DCMI_HandleTypeDef hdcmi; + DMA_HandleTypeDef hdma_dcmi; //MAP_CameraIntClear(CAMERA_BASE, CAM_INT_FE); // if(g_total_dma_intrpts > 1 && MAP_CameraIntStatus(CAMERA_BASE) & CAM_INT_FE) // { @@ -629,7 +593,8 @@ /* Insert 100ms delay: wait 100ms */ // wait_ms(100); -// DCMI_CaptureCmd(ENABLE); +// DCMI_CaptureCmd(ENABLE); +//HAL_DCMI_Start_DMA(hdcmi, DCMI_MODE_SNAPSHOT, WriteBuffer, Length) } //*****************************************************************************