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

Committer:
dflet
Date:
Wed Jun 24 09:54:16 2015 +0000
Revision:
0:50cedd586816
Child:
6:37fb696395d7
First commit work in progress

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dflet 0:50cedd586816 1 //*****************************************************************************
dflet 0:50cedd586816 2 // camera_app.h
dflet 0:50cedd586816 3 //
dflet 0:50cedd586816 4 // camera application macro & API's prototypes
dflet 0:50cedd586816 5 //
dflet 0:50cedd586816 6 // Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
dflet 0:50cedd586816 7 //
dflet 0:50cedd586816 8 //
dflet 0:50cedd586816 9 // Redistribution and use in source and binary forms, with or without
dflet 0:50cedd586816 10 // modification, are permitted provided that the following conditions
dflet 0:50cedd586816 11 // are met:
dflet 0:50cedd586816 12 //
dflet 0:50cedd586816 13 // Redistributions of source code must retain the above copyright
dflet 0:50cedd586816 14 // notice, this list of conditions and the following disclaimer.
dflet 0:50cedd586816 15 //
dflet 0:50cedd586816 16 // Redistributions in binary form must reproduce the above copyright
dflet 0:50cedd586816 17 // notice, this list of conditions and the following disclaimer in the
dflet 0:50cedd586816 18 // documentation and/or other materials provided with the
dflet 0:50cedd586816 19 // distribution.
dflet 0:50cedd586816 20 //
dflet 0:50cedd586816 21 // Neither the name of Texas Instruments Incorporated nor the names of
dflet 0:50cedd586816 22 // its contributors may be used to endorse or promote products derived
dflet 0:50cedd586816 23 // from this software without specific prior written permission.
dflet 0:50cedd586816 24 //
dflet 0:50cedd586816 25 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
dflet 0:50cedd586816 26 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
dflet 0:50cedd586816 27 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
dflet 0:50cedd586816 28 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
dflet 0:50cedd586816 29 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
dflet 0:50cedd586816 30 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
dflet 0:50cedd586816 31 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
dflet 0:50cedd586816 32 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
dflet 0:50cedd586816 33 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
dflet 0:50cedd586816 34 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
dflet 0:50cedd586816 35 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
dflet 0:50cedd586816 36 //
dflet 0:50cedd586816 37 //*****************************************************************************
dflet 0:50cedd586816 38
dflet 0:50cedd586816 39 #ifndef __CAMERA_APP_H__
dflet 0:50cedd586816 40 #define __CAMERA_APP_H__
dflet 0:50cedd586816 41
dflet 0:50cedd586816 42 //*****************************************************************************
dflet 0:50cedd586816 43 //
dflet 0:50cedd586816 44 // If building with a C++ compiler, make all of the definitions in this header
dflet 0:50cedd586816 45 // have a C binding.
dflet 0:50cedd586816 46 //
dflet 0:50cedd586816 47 //*****************************************************************************
dflet 0:50cedd586816 48 #ifdef __cplusplus
dflet 0:50cedd586816 49 extern "C"
dflet 0:50cedd586816 50 {
dflet 0:50cedd586816 51 #endif /* __cplusplus */
dflet 0:50cedd586816 52
dflet 0:50cedd586816 53 #define UART_COMMAND_IMG_CAPTURE ('x')
dflet 0:50cedd586816 54 #define LOWER_TO_UPPER_CASE (32)
dflet 0:50cedd586816 55
dflet 0:50cedd586816 56 #define DISABLE (0)
dflet 0:50cedd586816 57 #define ENABLE (1)
dflet 0:50cedd586816 58 #define SL_VERSION_LENGTH (11)
dflet 0:50cedd586816 59
dflet 0:50cedd586816 60 extern int PIXELS_IN_X_AXIS;
dflet 0:50cedd586816 61 extern int PIXELS_IN_X_AXIS;
dflet 0:50cedd586816 62 extern int FRAME_SIZE_IN_BYTES;
dflet 0:50cedd586816 63 #define NUM_OF_1KB_BUFFERS 50
dflet 0:50cedd586816 64
dflet 0:50cedd586816 65
dflet 0:50cedd586816 66 #define BYTES_PER_PIXEL (2) // RGB 565
dflet 0:50cedd586816 67
dflet 0:50cedd586816 68 #define ONE_KB (1024)
dflet 0:50cedd586816 69 #define IMAGE_BUF_SIZE (ONE_KB * NUM_OF_1KB_BUFFERS)
dflet 0:50cedd586816 70
dflet 0:50cedd586816 71 #define NUM_OF_4B_CHUNKS ((IMAGE_BUF_SIZE)/(sizeof(unsigned int)))
dflet 0:50cedd586816 72 #define NUM_OF_1KB_CHUNKS (IMAGE_BUF_SIZE/ONE_KB)
dflet 0:50cedd586816 73 #define NUM_OF_4B_CHUNKS_IN_1KB (ONE_KB/(sizeof(unsigned int)))
dflet 0:50cedd586816 74
dflet 0:50cedd586816 75 #define MAX_EMAIL_ID_LENGTH 34
dflet 0:50cedd586816 76 #define SMTP_BUF_LEN 1024
dflet 0:50cedd586816 77
dflet 0:50cedd586816 78 #define CAM_BT_CORRECT_EN 0x00001000
dflet 0:50cedd586816 79
dflet 0:50cedd586816 80 typedef enum opcd{
dflet 0:50cedd586816 81 START_CAPTURE = 1,
dflet 0:50cedd586816 82 STOP_CAPTURE,
dflet 0:50cedd586816 83 IMG_FMT,
dflet 0:50cedd586816 84 IMG_SIZE,
dflet 0:50cedd586816 85 EXIT
dflet 0:50cedd586816 86 }e_opcode;
dflet 0:50cedd586816 87
dflet 0:50cedd586816 88 typedef struct cmd_struct{
dflet 0:50cedd586816 89 int opcode;
dflet 0:50cedd586816 90 char email_id[MAX_EMAIL_ID_LENGTH];
dflet 0:50cedd586816 91 }s_cmd_struct;
dflet 0:50cedd586816 92
dflet 0:50cedd586816 93 //******************************************************************************
dflet 0:50cedd586816 94 // APIs
dflet 0:50cedd586816 95 //******************************************************************************
dflet 0:50cedd586816 96
dflet 0:50cedd586816 97 unsigned short StartCamera(char **WriteBuffer);
dflet 0:50cedd586816 98 int SetCameraResolution(int width, int height);
dflet 0:50cedd586816 99 void InitCameraComponents(int width, int height);
dflet 0:50cedd586816 100
dflet 0:50cedd586816 101 //*****************************************************************************
dflet 0:50cedd586816 102 //
dflet 0:50cedd586816 103 // Mark the end of the C bindings section for C++ compilers.
dflet 0:50cedd586816 104 //
dflet 0:50cedd586816 105 //*****************************************************************************
dflet 0:50cedd586816 106 #ifdef __cplusplus
dflet 0:50cedd586816 107 }
dflet 0:50cedd586816 108 #endif /* __cplusplus */
dflet 0:50cedd586816 109 #endif /* __CAMERA_APP_H__ */
dflet 0:50cedd586816 110
dflet 0:50cedd586816 111 //*****************************************************************************
dflet 0:50cedd586816 112 //
dflet 0:50cedd586816 113 // Close the Doxygen group.
dflet 0:50cedd586816 114 //! @}
dflet 0:50cedd586816 115 //
dflet 0:50cedd586816 116 //*****************************************************************************
dflet 0:50cedd586816 117