Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: camera_app/camera_app.cpp
- Revision:
- 4:c27adffcfec2
- Parent:
- 3:7643714ec664
- Child:
- 5:75fcfdb7cae7
diff -r 7643714ec664 -r c27adffcfec2 camera_app/camera_app.cpp
--- a/camera_app/camera_app.cpp Fri Jun 26 22:53:54 2015 +0000
+++ b/camera_app/camera_app.cpp Tue Jun 30 22:51:05 2015 +0000
@@ -41,7 +41,7 @@
//! @{
//
//*****************************************************************************
-#include "mbed.h"
+//#include "mbed.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -49,10 +49,13 @@
// SimpleLink include
#include "cc3100_simplelink.h"
+//#include "stm32f4xx_hal_dma.h"
+//#include "stm32f4xx_hal_dcmi.h"
+
#include "camera_app.h"
-
#include "mt9d111.h"
#include "i2cconfig.h"
+
#include "cli_uart.h"
#include "Led_config.h"
@@ -99,7 +102,7 @@
#ifdef ENABLE_JPEG
char g_header[SMTP_BUF_LEN] /*= {'\0'}*/;
#endif
- unsigned int g_image_buffer[NUM_OF_4B_CHUNKS];
+ unsigned int g_image_buffer[NUM_OF_4B_CHUNKS];//12800
};
ImageBuffer g_image;
@@ -360,8 +363,15 @@
//
Uart_Write((uint8_t*)"CaptureImage Start\n\r");
+ /* Enable the DCMI */
+// __HAL_DCMI_ENABLE(&hdcmi);
+ /* Enable the DMA */
+// __HAL_DMA_ENABLE(&hdma_dcmi);
+
HAL_NVIC_EnableIRQ(DMA2_Stream1_IRQn);
HAL_NVIC_EnableIRQ(DCMI_IRQn);
+ wait(1);
+ printf("\r\nBuffer size = %d\r\n",sizeof(g_image.g_image_buffer));
HAL_DCMI_Start_DMA(&hdcmi, DCMI_MODE_SNAPSHOT, (uint32_t)p_buffer, sizeof(g_image.g_image_buffer));
/* Wait for frame */
@@ -370,17 +380,23 @@
}
HAL_NVIC_DisableIRQ(DCMI_IRQn);
HAL_NVIC_DisableIRQ(DMA2_Stream1_IRQn);
+
+ /* Disable the DMA */
+// __HAL_DMA_DISABLE(&hdma_dcmi);
+ /* Disable the DCMI */
+// __HAL_DCMI_DISABLE(&hdcmi);
+
g_frame_end = 1;
Uart_Write((uint8_t*)"\n\rCaptureImage Complete\n\r");
/* 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(&hdma_dcmi);//need this???
+// HAL_DMA_Abort(&hdma_dcmi);//need this???
/* Read the number of data items transferred */
uint16_t image_size = (FRAME_SIZE_IN_BYTES - hdma_dcmi.Instance->NDTR)*4;
-
+ printf("image_size = %d\r\n",image_size);
//
// Create JPEG Header
//
@@ -501,32 +517,6 @@
// MAP_CameraIntEnable(CAMERA_BASE, CAM_INT_FE);
// MAP_CameraDMAEnable(CAMERA_BASE);
-// hdcmi.Instance = DCMI;
-// hdcmi.Init.SynchroMode = DCMI_SYNCHRO_HARDWARE;
-// hdcmi.Init.PCKPolarity = DCMI_PCKPOLARITY_FALLING;
-// hdcmi.Init.VSPolarity = DCMI_VSPOLARITY_LOW;
-// hdcmi.Init.HSPolarity = DCMI_HSPOLARITY_LOW;
-// hdcmi.Init.CaptureRate = DCMI_CR_ALL_FRAME;
-// hdcmi.Init.ExtendedDataMode = DCMI_EXTEND_DATA_8B;
-//#ifdef ENABLE_JPEG
-// hdcmi.Init.JPEGMode = DCMI_JPEG_ENABLE;
-//#else
-// hdcmi.Init.JPEGMode = DCMI_JPEG_DISABLE;
-//#endif
-// HAL_DCMI_Init(&hdcmi);
-
-/*
- hdcmi.Instance = DCMI;
- hdcmi.Init.SynchroMode = DCMI_SYNCHRO_EMBEDDED;
- hdcmi.Init.PCKPolarity = DCMI_PCKPOLARITY_FALLING;
- hdcmi.Init.ExtendedDataMode = DCMI_EXTEND_DATA_8B;
- hdcmi.Init.SyncroCode.FrameEndCode = 0;
- hdcmi.Init.SyncroCode.FrameStartCode = 0;
- hdcmi.Init.SyncroCode.LineStartCode = 0;
- hdcmi.Init.SyncroCode.LineEndCode = 0;
- HAL_DCMI_Init(&hdcmi);
-*/
-
}
@@ -541,8 +531,8 @@
static void CameraIntHandler()
{
Uart_Write((uint8_t*)"CameraIntHandler \n\r");
- DCMI_HandleTypeDef hdcmi;
- DMA_HandleTypeDef hdma_dcmi;
+// 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)
// {