エレキジャック Web版 マイコン・カーを製作してみよう<17> カメラで撮影した画像をパソコンに表示するためのプログラムです。http://www.eleki-jack.com/arm/2012/08/17.html パソコン用のプログラムはC1098View.exeです。詳しくはエレキジャックのページを参照ください。

Dependencies:   CameraC1098 TextLCD mbed

C1098シリアルカメラをmbedで制御しています。mbedからPCへ送った画像データをC1098View.exeで表示したものです。 /media/uploads/sunifu/-15__c1098view_----.jpg

詳しくはエレキジャックのページを参照ください。 マイコン・カーを製作してみよう(16) http://www.eleki-jack.com/arm/2012/08/16.html マイコン・カーを製作してみよう(17) http://www.eleki-jack.com/arm/2012/08/17.html

Files at this revision

API Documentation at this revision

Comitter:
sunifu
Date:
Mon Sep 03 14:29:41 2012 +0000
Commit message:
V1.0

Changed in this revision

CameraC1098.lib Show annotated file Show diff for this revision Revisions of this file
TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 985e1f891b2e CameraC1098.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CameraC1098.lib	Mon Sep 03 14:29:41 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/sunifu/code/CameraC1098/#5a6468b4164d
diff -r 000000000000 -r 985e1f891b2e TextLCD.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Mon Sep 03 14:29:41 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/TextLCD/#44f34c09bd37
diff -r 000000000000 -r 985e1f891b2e main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Sep 03 14:29:41 2012 +0000
@@ -0,0 +1,88 @@
+#include "mbed.h"
+#include "CameraC1098.h"
+#include "TextLCD.h"
+
+static char buf[256+1];
+
+TextLCD lcd(p24, p26, p27, p28, p29, p30);
+CameraC1098 camera(p9, p10);
+Serial pc(p13,p14);
+
+/**
+ * A callback function for jpeg images.
+ * You can block this function until saving the image datas.
+ *
+ * @param buf A pointer to the image buffer.
+ * @param siz A size of the image buffer.
+ */
+void jpeg_callback(char *buf, size_t siz) {
+    for (int i = 0; i < (int)siz; i++) {
+        pc.putc(buf[i]);
+    }
+}
+
+/**
+ * Synchronizing.
+ */
+void sync(void) {
+    CameraC1098::ErrorNumber err = CameraC1098::NoError;
+
+    err = camera.sync();
+    lcd.locate(0,0);
+    if (CameraC1098::NoError == err) {
+        printf("[ OK ] : CameraC1098::sync\r\n");
+        lcd.printf("C1098:Sync [OK] ");
+        
+    } else {
+        printf("[FAIL] : CameraC1098::sync (Error=%02X)\r\n", (int)err);
+        lcd.printf("C1098:Sync[FAIL]");
+    }
+}
+
+
+/**
+ * A test function for jpeg snapshot picture.
+ */
+void test_jpeg_snapshot_picture() {
+    CameraC1098::ErrorNumber err = CameraC1098::NoError; 
+    
+    err = camera.getJpegSnapshotPicture(jpeg_callback);
+    lcd.locate(0,1);
+    if (CameraC1098::NoError == err) {
+        printf("[ OK ] : CameraC1098::getJpegSnapshotPicture\r\n");
+        lcd.printf("getJpgPict [OK] ");
+    } else {
+        printf("[FAIL] : CameraC1098::getJpegSnapshotPicture (Error=%02X)\r\n", (int)err);
+        lcd.printf("getJpgPict[FAIL]");
+    }
+}
+
+/**
+ * A entry point.
+ */
+int main() {
+    printf("\r\n");
+    printf("==========\r\n"); 
+    printf("CameraC1098\r\n");
+    printf("==========\r\n");
+    CameraC1098::ErrorNumber err = CameraC1098::NoError;
+    err = camera.init(CameraC1098::Baud460800, CameraC1098::JpegResolution320x240);  
+    camera.setmbedBaud( CameraC1098::Baud460800 );
+    pc.baud(460800); 
+    
+    lcd.cls();
+    lcd.locate(0,0);
+    if (CameraC1098::NoError == err) {
+        printf("[ OK ] : CameraC1098::init\r\n");
+        lcd.printf("C1098:init [OK] ");
+    } else {
+        printf("[FAIL] : CameraC1098::init (Error=%02X)\r\n", (int)err);
+        lcd.printf("C1098:init[FAIL]");
+    }
+    sync();
+
+    while(1){    
+        test_jpeg_snapshot_picture(); 
+    }
+    return 0;
+}
diff -r 000000000000 -r 985e1f891b2e mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Sep 03 14:29:41 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/737756e0b479
\ No newline at end of file