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.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Camera_app

Camera_app

Functions

uint32_t StartCamera (char **WriteBuffer)
 Start Camera 1.
void InitCameraComponents (int width, int height)
 InitCameraComponents PinMux, Camera Initialization and Configuration.
int SetCameraResolution (int width, int height)
 Set resolution of camera.
uint32_t CaptureImage (char **WriteBuffer)
 CaptureImage Configures DMA and starts the Capture.
void DMAConfig ()
 DMA Config Initialize the DMA and Setup the DMA transfer.
void DCMI_MspInit (DCMI_HandleTypeDef *hdcmi)
void HAL_DCMI_MspDeInit (DCMI_HandleTypeDef *hdcmi)
static int JfifApp0Marker (char *pbuf)
 JfifApp0Marker.
static int FrameHeaderMarker (char *pbuf, int width, int height, int format)
 FrameHeaderMarker.
static int ScanHeaderMarker (char *pbuf, int format)
 ScanHeaderMarker.
static int DefineQuantizationTableMarker (unsigned char *pbuf, int qscale, int format)
 DefineQuantizationTableMarker Calculate and write the quantisation tables qscale is the customised scaling factor - see MT9D131 developer guide page 78.
static int DefineHuffmanTableMarkerDC (char *pbuf, unsigned int *htable, int class_id)
 DefineHuffmanTableMarkerDC.
static int DefineHuffmanTableMarkerAC (char *pbuf, unsigned int *htable, int class_id)
 DefineHuffmanTableMarkerAC 1.
static int DefineRestartIntervalMarker (char *pbuf, int ri)
 DefineRestartIntervalMarker.
static int CreateJpegHeader (char *header, int width, int height, int format, int restart_int, int qscale)
 CreateJpegHeader Create JPEG Header in JFIF format.

Function Documentation

uint32_t CaptureImage ( char **  WriteBuffer )

CaptureImage Configures DMA and starts the Capture.

Post Capture writes to SFLASH

Parameters:
None
Returns:
None

Definition at line 345 of file camera_app.cpp.

static int CreateJpegHeader ( char *  header,
int  width,
int  height,
int  format,
int  restart_int,
int  qscale 
) [static]

CreateJpegHeader Create JPEG Header in JFIF format.

header - pointer to JPEG header buffer width - image width height - image height format - color format (0 = YCbCr422, 1 = YCbCr420, 2 = monochrome) restart_int - restart marker interval qscale - quantization table scaling factor

Returns:
length of JPEG header (bytes)

Definition at line 1066 of file camera_app.cpp.

void DCMI_MspInit ( DCMI_HandleTypeDef *  hdcmi )

MCO1 GPIO Configuration PA8 ------> RCC_MCO_1

DCMI GPIO Configuration PA9 ------> DCMI_D0 PA10 ------> DCMI_D1 PC8 ------> DCMI_D2 PC9 ------> DCMI_D3 PE4 ------> DCMI_D4 PB6 ------> DCMI_D5 PE5 ------> DCMI_D6 PE6 ------> DCMI_D7 PA6 ------> DCMI_PIXCK PA4 ------> DCMI_HSYNC PB7 ------> DCMI_VSYNC

Definition at line 471 of file camera_app.cpp.

static int DefineHuffmanTableMarkerAC ( char *  pbuf,
unsigned int *  htable,
int  class_id 
) [static]

DefineHuffmanTableMarkerAC 1.

Establishes connection w/ AP// 2. Initializes the camera sub-components//! GPIO Enable & Configuration 3. Listens and processes the image capture requests from user-applications

pointer to Marker buffer Huffman table Class Identifier

Returns:
Length of the Marker

Definition at line 964 of file camera_app.cpp.

static int DefineHuffmanTableMarkerDC ( char *  pbuf,
unsigned int *  htable,
int  class_id 
) [static]

DefineHuffmanTableMarkerDC.

pointer to Marker buffer Huffman table Class Identifier

Returns:
Length of the marker

Definition at line 909 of file camera_app.cpp.

static int DefineQuantizationTableMarker ( unsigned char *  pbuf,
int  qscale,
int  format 
) [static]

DefineQuantizationTableMarker Calculate and write the quantisation tables qscale is the customised scaling factor - see MT9D131 developer guide page 78.

pointer to the output buffer Quantization Scale Format

Returns:
Length of the Marker

Definition at line 841 of file camera_app.cpp.

static int DefineRestartIntervalMarker ( char *  pbuf,
int  ri 
) [static]

DefineRestartIntervalMarker.

pointer to Marker buffer return interval

Returns:
Length

Definition at line 1039 of file camera_app.cpp.

void DMAConfig ( void   )

DMA Config Initialize the DMA and Setup the DMA transfer.

Parameters:
None
Returns:
None

Definition at line 438 of file camera_app.cpp.

static int FrameHeaderMarker ( char *  pbuf,
int  width,
int  height,
int  format 
) [static]

FrameHeaderMarker.

pointer to the output buffer width height format

Returns:
Length of the header marker

Definition at line 732 of file camera_app.cpp.

void HAL_DCMI_MspDeInit ( DCMI_HandleTypeDef *  hdcmi )

DCMI GPIO Configuration PE4 ------> DCMI_D4 PE5 ------> DCMI_D6 PE6 ------> DCMI_D7 PA4 ------> DCMI_HSYNC PA6 ------> DCMI_PIXCK PC8 ------> DCMI_D2 PC9 ------> DCMI_D3 PA9 ------> DCMI_D0 PA10 ------> DCMI_D1 PB6 ------> DCMI_D5 PB7 ------> DCMI_VSYNC

PA8 ------> MCO1

Definition at line 641 of file camera_app.cpp.

void InitCameraComponents ( int  width,
int  height 
)

InitCameraComponents PinMux, Camera Initialization and Configuration.

Parameters:
[in]width- X-Axis
[in]width- Y-Axis
Returns:
None

Definition at line 271 of file camera_app.cpp.

static int JfifApp0Marker ( char *  pbuf ) [static]

JfifApp0Marker.

Parameters:
Pointerto the output buffer
Returns:
Length of the Marker

Definition at line 695 of file camera_app.cpp.

static int ScanHeaderMarker ( char *  pbuf,
int  format 
) [static]

ScanHeaderMarker.

pointer to output buffer Format

Returns:
Length

Definition at line 794 of file camera_app.cpp.

int SetCameraResolution ( int  width,
int  height 
)

Set resolution of camera.

Parameters:
[in]width- X Axis
[in]height- Y Axis
Returns:
0 on success else -ve

Definition at line 323 of file camera_app.cpp.

uint32_t StartCamera ( char **  WriteBuffer )

Start Camera 1.

Establishes connection w/ AP// 2. Initializes the camera sub-components//! GPIO Enable & Configuration 3. Listens and processes the image capture requests from user-applications

Parameters:
[out]WriteBuffer- Pointer to the Frame Buffer
Returns:
None

Definition at line 249 of file camera_app.cpp.