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.
camera_app.h
00001 //***************************************************************************** 00002 // camera_app.h 00003 // 00004 // camera application macro & API's prototypes 00005 // 00006 // Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ 00007 // 00008 // 00009 // Redistribution and use in source and binary forms, with or without 00010 // modification, are permitted provided that the following conditions 00011 // are met: 00012 // 00013 // Redistributions of source code must retain the above copyright 00014 // notice, this list of conditions and the following disclaimer. 00015 // 00016 // Redistributions in binary form must reproduce the above copyright 00017 // notice, this list of conditions and the following disclaimer in the 00018 // documentation and/or other materials provided with the 00019 // distribution. 00020 // 00021 // Neither the name of Texas Instruments Incorporated nor the names of 00022 // its contributors may be used to endorse or promote products derived 00023 // from this software without specific prior written permission. 00024 // 00025 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00026 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00027 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00028 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00029 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00030 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00031 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00032 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00033 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00034 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00035 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 // 00037 //***************************************************************************** 00038 00039 #ifndef __CAMERA_APP_H__ 00040 #define __CAMERA_APP_H__ 00041 00042 //***************************************************************************** 00043 // 00044 // If building with a C++ compiler, make all of the definitions in this header 00045 // have a C binding. 00046 // 00047 //***************************************************************************** 00048 #ifdef __cplusplus 00049 extern "C" 00050 { 00051 #endif /* __cplusplus */ 00052 00053 #define UART_COMMAND_IMG_CAPTURE ('x') 00054 #define LOWER_TO_UPPER_CASE (32) 00055 00056 #define DISABLE (0) 00057 #define ENABLE (1) 00058 #define SL_VERSION_LENGTH (11) 00059 00060 extern int PIXELS_IN_X_AXIS; 00061 extern int PIXELS_IN_X_AXIS; 00062 extern int FRAME_SIZE_IN_BYTES; 00063 00064 #define NUM_OF_1KB_BUFFERS 25 00065 00066 00067 #define BYTES_PER_PIXEL (2) // RGB 565 00068 00069 #define ONE_KB (1024) 00070 #define IMAGE_BUF_SIZE (ONE_KB * NUM_OF_1KB_BUFFERS) 00071 00072 #define NUM_OF_4B_CHUNKS ((IMAGE_BUF_SIZE - ONE_KB)/(sizeof(unsigned int))) 00073 #define NUM_OF_1KB_CHUNKS (IMAGE_BUF_SIZE/ONE_KB) 00074 #define NUM_OF_4B_CHUNKS_IN_1KB (ONE_KB/(sizeof(unsigned int))) 00075 00076 #define MAX_EMAIL_ID_LENGTH 34 00077 #define SMTP_BUF_LEN 1024 00078 00079 //#define CAM_BT_CORRECT_EN 0x00001000 00080 00081 typedef enum opcd{ 00082 START_CAPTURE = 1, 00083 STOP_CAPTURE, 00084 IMG_FMT, 00085 IMG_SIZE, 00086 EXIT 00087 }e_opcode; 00088 00089 typedef struct cmd_struct{ 00090 int opcode; 00091 char email_id[MAX_EMAIL_ID_LENGTH]; 00092 }s_cmd_struct; 00093 00094 //****************************************************************************** 00095 // APIs 00096 //****************************************************************************** 00097 00098 uint32_t StartCamera(char **WriteBuffer); 00099 int SetCameraResolution(int width, int height); 00100 void InitCameraComponents(int width, int height); 00101 00102 static void CamControllerInit(void); 00103 static void CameraIntHandler(void); 00104 uint32_t CaptureImage(char **WriteBuffer); 00105 void DMAConfig(void); 00106 void DCMI_MspInit (DCMI_HandleTypeDef* hdcmi); 00107 00108 /****************************************************************************/ 00109 /* LOCAL FUNCTION PROTOTYPES */ 00110 /****************************************************************************/ 00111 //#ifdef ENABLE_JPEG 00112 static int CreateJpegHeader(char *header, int width, int height, 00113 int format, int restart_int, int qscale); 00114 static int DefineRestartIntervalMarker(char *pbuf, int ri); 00115 static int DefineHuffmanTableMarkerAC(char *pbuf, unsigned int *htable, int class_id); 00116 static int DefineHuffmanTableMarkerDC(char *pbuf, unsigned int *htable, int class_id); 00117 static int DefineQuantizationTableMarker (unsigned char *pbuf, int qscale, int format); 00118 static int ScanHeaderMarker(char *pbuf, int format); 00119 static int FrameHeaderMarker(char *pbuf, int width, int height, int format); 00120 static int JfifApp0Marker(char *pbuf); 00121 //#endif 00122 00123 //***************************************************************************** 00124 // 00125 // Mark the end of the C bindings section for C++ compilers. 00126 // 00127 //***************************************************************************** 00128 #ifdef __cplusplus 00129 } 00130 #endif /* __cplusplus */ 00131 #endif /* __CAMERA_APP_H__ */ 00132 00133 //***************************************************************************** 00134 // 00135 // Close the Doxygen group. 00136 //! @} 00137 // 00138 //***************************************************************************** 00139
Generated on Tue Jul 12 2022 22:22:37 by 1.7.2