This is an digital video camera program using NKK\'s oLED swtich and 4D Systems\' uCam serial camera. It takes image from the uCam and displays on the IS-C15 switch. Some image processing demos are included. This program uses FatFileSytem, SDFileSystem, and TextLCD library. See http://www.youtube.com/watch?v=fqHTaCRHyQs for how it works. CQ出版社の「mbed/ARM活用事例」第10章シリアル接続カメラと有機ELディスプレイ内蔵スイッチで作るmbedディジタル・カメラの作例です。動作の様子は http://www.youtube.com/watch?v=fqHTaCRHyQs で見れます。
Dependencies: TextLCD mbed SDFileSystem
ucam.h
00001 /* 4D Systems uCam serial RAW/JPEG camera library 00002 * Copyright (c) 2011, Noriaki Mitsunaga 00003 * 00004 * Permission is hereby granted, free of charge, to any person obtaining a copy 00005 * of this software and associated documentation files (the "Software"), to deal 00006 * in the Software without restriction, including without limitation the rights 00007 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00008 * copies of the Software, and to permit persons to whom the Software is 00009 * furnished to do so, subject to the following conditions: 00010 * 00011 * The above copyright notice and this permission notice shall be included in 00012 * all copies or substantial portions of the Software. 00013 * 00014 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00015 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00016 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00017 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00018 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00019 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00020 * THE SOFTWARE. 00021 */ 00022 #ifndef __UCAM_H__ 00023 #define __UCAM_H__ 00024 00025 #include "mbed.h" 00026 00027 #define UCAM_COLOR_TYPE_2BITG 0x1 00028 #define UCAM_COLOR_TYPE_4BITG 0x2 00029 #define UCAM_COLOR_TYPE_8BITG 0x3 00030 #define UCAM_COLOR_TYPE_RGB332 0x4 00031 #define UCAM_COLOR_TYPE_RGB444 0x5 00032 #define UCAM_COLOR_TYPE_RGB565 0x6 00033 #define UCAM_COLOR_TYPE_JPEG 0x7 00034 00035 #define UCAM_RAW_RESOLUTION_80X60 0x1 00036 #define UCAM_RAW_RESOLUTION_160X120 0x3 00037 #define UCAM_RAW_RESOLUTION_320X240 0x5 00038 #define UCAM_RAW_RESOLUTION_640X480 0x7 00039 #define UCAM_RAW_RESOLUTION_128x128 0x9 00040 #define UCAM_RAW_RESOLUTION_128x96 0xB 00041 00042 const int ucam_raw_resolution_w[] = {80, 160, 320, 640, 128, 128}; 00043 const int ucam_raw_resolution_h[] = {60, 120, 240, 480, 128, 96}; 00044 00045 #define UCAM_JPEG_RESOLUTION_80X64 0x1 00046 #define UCAM_JPEG_RESOLUTION_160X128 0x3 00047 #define UCAM_JPEG_RESOLUTION_320X240 0x5 00048 #define UCAM_JPEG_RESOLUTION_640X480 0x7 00049 00050 class uCam { 00051 public: 00052 uCam(PinName tx, PinName rx) { 00053 s = new Serial(tx, rx); 00054 s->baud(57600); 00055 } 00056 ~uCam() { 00057 delete s; 00058 } 00059 00060 int Command(const unsigned char *cmd); 00061 void ACK_F0F0(); 00062 int Init(); 00063 int LightFreq(int f); 00064 void Reset(); 00065 int SnapshotRaw(int Color, int Res, unsigned char *buf); 00066 int SnapshotRawCrop(int Color, int Res, 00067 int x0, int y0, int w, int h, 00068 unsigned char *buf); 00069 int SnapshotJPEGi(int Res, int pksz); 00070 int SnapshotJPEGd(int no, unsigned char *buf, int pksz); 00071 00072 private: 00073 Serial *s; 00074 00075 int checkACK(const unsigned char *buf); 00076 int checkSYNC(const unsigned char *buf); 00077 void read(unsigned char *p, int len); 00078 int readT(unsigned char *buf, int len); 00079 void write(const unsigned char *p, int len); 00080 }; 00081 00082 #endif
Generated on Wed Jul 13 2022 21:19:27 by 1.7.2