test

Dependencies:   CameraC1098 FatFileSystem HeptaGPS SDHC_Lib mbed

Fork of CameraC1098_picture by Tadao Iida

Files at this revision

API Documentation at this revision

Comitter:
hepta2ume
Date:
Thu Aug 03 04:29:31 2017 +0000
Parent:
1:06966e960702
Commit message:
test;

Changed in this revision

CameraC1098.lib Show annotated file Show diff for this revision Revisions of this file
HeptaGPS.lib Show annotated file Show diff for this revision Revisions of this file
TextLCD.lib Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 06966e960702 -r 179f10ab0744 CameraC1098.lib
--- a/CameraC1098.lib	Fri Jul 27 14:37:21 2012 +0000
+++ b/CameraC1098.lib	Thu Aug 03 04:29:31 2017 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/sunifu/code/CameraC1098/#5a6468b4164d
+https://developer.mbed.org/users/hepta2ume/code/CameraC1098/#135493341acc
diff -r 06966e960702 -r 179f10ab0744 HeptaGPS.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HeptaGPS.lib	Thu Aug 03 04:29:31 2017 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/hepta2ume/code/HeptaGPS/#1be20a74923d
diff -r 06966e960702 -r 179f10ab0744 TextLCD.lib
--- a/TextLCD.lib	Fri Jul 27 14:37:21 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/simon/code/TextLCD/#44f34c09bd37
diff -r 06966e960702 -r 179f10ab0744 main.cpp
--- a/main.cpp	Fri Jul 27 14:37:21 2012 +0000
+++ b/main.cpp	Thu Aug 03 04:29:31 2017 +0000
@@ -1,122 +1,35 @@
 #include "mbed.h"
-#include "CameraC1098.h"
 #include "SDHCFileSystem.h"
-#include "TextLCD.h"
- 
-/*
- * Definitions.
- */
-#define USE_SD_CARD 1
-
-/*
- * Variables.
- */
-static const int CAPTURE_FRAMES = 1;
-static char buf[256+1];
-static FILE *fp_jpeg;
-
-/*
- * Modules.
- */
-#if USE_SD_CARD
+#include "CameraC1098.h"
+#include "HeptaGPS.h"
+Serial pc(USBTX, USBRX); // tx, rx
 SDFileSystem sd(p5, p6, p7, p8, "fs");
-#else
-LocalFileSystem fs("fs");
-#endif
-
-TextLCD lcd(p24, p26, p27, p28, p29, p30);
-CameraC1098 camera(p9, p10);
- 
-
-/**
- * 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++) {
-        fprintf(fp_jpeg, "%c", 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(int j) {
-    CameraC1098::ErrorNumber err = CameraC1098::NoError; 
-    for (int i = 0; i < CAPTURE_FRAMES; i++) {
-        char fname[64];
-        snprintf(fname, sizeof(fname), "/fs/jpss%02d-%02d.jpg",i, j);
-        fp_jpeg = fopen(fname, "w");
-        if ( fp_jpeg == NULL ){
-            lcd.locate(0,1);
-            lcd.printf("File Open Fail ");
-            exit(1);
+//HeptaGPS gps(p13,p14);
+CameraC1098 camera(p13, p14, CameraC1098::Baud115200);//Baud消したい①
+HeptaGPS gps(p13,p14);
+DigitalOut CAM_SW(p25);//CAM_control
+DigitalOut GPS_SW(p24);//GPS_control
+char mode;
+int main()
+{
+    pc.baud(115200);
+    pc.printf("mode select\r\n");
+    while(1) {
+        mode = pc.getc();
+        if(mode == 'c') {
+            pc.printf("%c\r\n",mode);
+            CAM_SW=1;
+            GPS_SW=0;
+            camera.Sync();
+            camera.jpeg_snapshot(1);
+            pc.printf("Finish\r\n");
+        } else if(mode == 'g') {
+            pc.printf("%c\r\n",mode);
+            CAM_SW=0;
+            GPS_SW=1;
+            gps.baud(9600);
+           while(1) pc.putc(gps.getc());
         }
 
-        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]");
-        }
-        fclose(fp_jpeg);
     }
-}
-
-/**
- * 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::JpegResolution80x64);    
-     
-    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();
-    
-    test_jpeg_snapshot_picture(1); 
-    err = camera.init(CameraC1098::Baud460800, CameraC1098::JpegResolution160x128);   
-    test_jpeg_snapshot_picture(2);        
-    err = camera.init(CameraC1098::Baud460800, CameraC1098::JpegResolution320x240);   
-    test_jpeg_snapshot_picture(3);    
-    err = camera.init(CameraC1098::Baud460800, CameraC1098::JpegResolution640x480);   
-    test_jpeg_snapshot_picture(4);         
-    
-    return 0;
-}
+}
\ No newline at end of file