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

Committer:
non
Date:
Thu Oct 13 02:41:04 2011 +0000
Revision:
2:0621feb3adf2
Parent:
0:07d02a20d1cc

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
non 0:07d02a20d1cc 1 /* 4D Systems uCam serial RAW/JPEG camera library
non 0:07d02a20d1cc 2 * Copyright (c) 2011, Noriaki Mitsunaga
non 0:07d02a20d1cc 3 *
non 0:07d02a20d1cc 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
non 0:07d02a20d1cc 5 * of this software and associated documentation files (the "Software"), to deal
non 0:07d02a20d1cc 6 * in the Software without restriction, including without limitation the rights
non 0:07d02a20d1cc 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
non 0:07d02a20d1cc 8 * copies of the Software, and to permit persons to whom the Software is
non 0:07d02a20d1cc 9 * furnished to do so, subject to the following conditions:
non 0:07d02a20d1cc 10 *
non 0:07d02a20d1cc 11 * The above copyright notice and this permission notice shall be included in
non 0:07d02a20d1cc 12 * all copies or substantial portions of the Software.
non 0:07d02a20d1cc 13 *
non 0:07d02a20d1cc 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
non 0:07d02a20d1cc 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
non 0:07d02a20d1cc 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
non 0:07d02a20d1cc 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
non 0:07d02a20d1cc 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
non 0:07d02a20d1cc 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
non 0:07d02a20d1cc 20 * THE SOFTWARE.
non 0:07d02a20d1cc 21 */
non 0:07d02a20d1cc 22 #ifndef __UCAM_H__
non 0:07d02a20d1cc 23 #define __UCAM_H__
non 0:07d02a20d1cc 24
non 0:07d02a20d1cc 25 #include "mbed.h"
non 0:07d02a20d1cc 26
non 0:07d02a20d1cc 27 #define UCAM_COLOR_TYPE_2BITG 0x1
non 0:07d02a20d1cc 28 #define UCAM_COLOR_TYPE_4BITG 0x2
non 0:07d02a20d1cc 29 #define UCAM_COLOR_TYPE_8BITG 0x3
non 0:07d02a20d1cc 30 #define UCAM_COLOR_TYPE_RGB332 0x4
non 0:07d02a20d1cc 31 #define UCAM_COLOR_TYPE_RGB444 0x5
non 0:07d02a20d1cc 32 #define UCAM_COLOR_TYPE_RGB565 0x6
non 0:07d02a20d1cc 33 #define UCAM_COLOR_TYPE_JPEG 0x7
non 0:07d02a20d1cc 34
non 0:07d02a20d1cc 35 #define UCAM_RAW_RESOLUTION_80X60 0x1
non 0:07d02a20d1cc 36 #define UCAM_RAW_RESOLUTION_160X120 0x3
non 0:07d02a20d1cc 37 #define UCAM_RAW_RESOLUTION_320X240 0x5
non 0:07d02a20d1cc 38 #define UCAM_RAW_RESOLUTION_640X480 0x7
non 0:07d02a20d1cc 39 #define UCAM_RAW_RESOLUTION_128x128 0x9
non 0:07d02a20d1cc 40 #define UCAM_RAW_RESOLUTION_128x96 0xB
non 0:07d02a20d1cc 41
non 0:07d02a20d1cc 42 const int ucam_raw_resolution_w[] = {80, 160, 320, 640, 128, 128};
non 0:07d02a20d1cc 43 const int ucam_raw_resolution_h[] = {60, 120, 240, 480, 128, 96};
non 0:07d02a20d1cc 44
non 0:07d02a20d1cc 45 #define UCAM_JPEG_RESOLUTION_80X64 0x1
non 0:07d02a20d1cc 46 #define UCAM_JPEG_RESOLUTION_160X128 0x3
non 0:07d02a20d1cc 47 #define UCAM_JPEG_RESOLUTION_320X240 0x5
non 0:07d02a20d1cc 48 #define UCAM_JPEG_RESOLUTION_640X480 0x7
non 0:07d02a20d1cc 49
non 0:07d02a20d1cc 50 class uCam {
non 0:07d02a20d1cc 51 public:
non 0:07d02a20d1cc 52 uCam(PinName tx, PinName rx) {
non 0:07d02a20d1cc 53 s = new Serial(tx, rx);
non 0:07d02a20d1cc 54 s->baud(57600);
non 0:07d02a20d1cc 55 }
non 0:07d02a20d1cc 56 ~uCam() {
non 0:07d02a20d1cc 57 delete s;
non 0:07d02a20d1cc 58 }
non 0:07d02a20d1cc 59
non 0:07d02a20d1cc 60 int Command(const unsigned char *cmd);
non 0:07d02a20d1cc 61 void ACK_F0F0();
non 0:07d02a20d1cc 62 int Init();
non 0:07d02a20d1cc 63 int LightFreq(int f);
non 0:07d02a20d1cc 64 void Reset();
non 0:07d02a20d1cc 65 int SnapshotRaw(int Color, int Res, unsigned char *buf);
non 0:07d02a20d1cc 66 int SnapshotRawCrop(int Color, int Res,
non 0:07d02a20d1cc 67 int x0, int y0, int w, int h,
non 0:07d02a20d1cc 68 unsigned char *buf);
non 0:07d02a20d1cc 69 int SnapshotJPEGi(int Res, int pksz);
non 0:07d02a20d1cc 70 int SnapshotJPEGd(int no, unsigned char *buf, int pksz);
non 0:07d02a20d1cc 71
non 0:07d02a20d1cc 72 private:
non 0:07d02a20d1cc 73 Serial *s;
non 0:07d02a20d1cc 74
non 0:07d02a20d1cc 75 int checkACK(const unsigned char *buf);
non 0:07d02a20d1cc 76 int checkSYNC(const unsigned char *buf);
non 0:07d02a20d1cc 77 void read(unsigned char *p, int len);
non 0:07d02a20d1cc 78 int readT(unsigned char *buf, int len);
non 0:07d02a20d1cc 79 void write(const unsigned char *p, int len);
non 0:07d02a20d1cc 80 };
non 0:07d02a20d1cc 81
non 0:07d02a20d1cc 82 #endif