Hepta_Cam&GPS

Dependents:   Hepta_Camera_test

Fork of CameraC1098 by Tadao Iida

Files at this revision

API Documentation at this revision

Comitter:
hepta2ume
Date:
Fri Jul 21 10:35:56 2017 +0000
Parent:
2:686c7043f5f4
Commit message:
HeptaSerial

Changed in this revision

HeptaSerial.cpp Show annotated file Show diff for this revision Revisions of this file
HeptaSerial.h Show annotated file Show diff for this revision Revisions of this file
diff -r 686c7043f5f4 -r 12659e671bad HeptaSerial.cpp
--- a/HeptaSerial.cpp	Wed Jul 19 09:20:37 2017 +0000
+++ b/HeptaSerial.cpp	Fri Jul 21 10:35:56 2017 +0000
@@ -14,7 +14,7 @@
  */
 HeptaSerial::HeptaSerial(PinName tx, PinName rx, int baud) : serial(tx, rx)
 {
-    serial.baud(baud);
+    //serial.baud(baud);
 }
 
 /**
@@ -613,9 +613,10 @@
 void HeptaSerial::Sync(void)
 {
     HeptaSerial::ErrorNumber err = HeptaSerial::NoError;
-    setmbedBaud(HeptaSerial::Baud14400);
+    serial._baud(14400);
     err = sync();
-    setmbedBaud(HeptaSerial::Baud115200);
+    //setmbedBaud(HeptaSerial::Baud115200);
+    //err = sync();
     if (HeptaSerial::NoError == err) {
         printf("[ OK ] : Camera::sync\r\n");
     } else {
@@ -623,7 +624,7 @@
     }
 }
 
-void HeptaSerial::test_jpeg_snapshot_picture(void)
+void HeptaSerial::test_jpeg_snapshot_picture(int CAPTURE_FRAMES)
 {
     HeptaSerial::ErrorNumber err = HeptaSerial::NoError;
     for (int i = 0; i < CAPTURE_FRAMES; i++) {
@@ -642,7 +643,7 @@
     }
 }
 
-void HeptaSerial::test_jpeg_snapshot_data(void)
+void HeptaSerial::test_jpeg_snapshot_data(int CAPTURE_FRAMES)
 {
     HeptaSerial::ErrorNumber err = HeptaSerial::NoError;
     for (int i = 0; i < CAPTURE_FRAMES; i++) {
@@ -664,8 +665,8 @@
 void HeptaSerial::initialize(Baud baud,JpegResolution jr)
 {
     HeptaSerial::ErrorNumber err = HeptaSerial::NoError;//ErrorNumber define
+    setmbedBaud(baud);
     err = init(baud, jr);//
-
     if (HeptaSerial::NoError == err) {
         printf("[ OK ] : Camera::init\r\n");
     } else {
diff -r 686c7043f5f4 -r 12659e671bad HeptaSerial.h
--- a/HeptaSerial.h	Wed Jul 19 09:20:37 2017 +0000
+++ b/HeptaSerial.h	Fri Jul 21 10:35:56 2017 +0000
@@ -1,31 +1,12 @@
-/**
- * C1098-SS device driver class (Version 1.0)
- * Reference documents: C1098-SS User Manual v1.0 2012.5.6
- *
- * CameraC328Library
- * Copyright (C) 2010 Shinichiro Nakamura (CuBeatSystems)
- * http://shinta.main.jp/
- *
- * CameraC1098-SS Library
- * Copyright (C) 2012 Tadao Iida
- */
-
 #include "mbed.h"
 #include "SerialBuffered.h"
 
 #ifndef HEPTA_SERIAL_H
 #define HEPTA_SERIAL_H
 
-/*
- * Class: HeptaSerial
- */
- 
 class HeptaSerial {
 public:
 
-    /**
-     * @enum JPEG resolution.
-     */
     enum JpegResolution {
          JpegResolution80x64 = 0x01,   // unofficial
          JpegResolution160x128 = 0x03, // unofficial
@@ -33,9 +14,6 @@
          JpegResolution640x480 = 0x07  // VGA
     };
 
-    /**
-     * @enum Error number.
-     */
     enum ErrorNumber {
         NoError = 0x00,
         UnexpectedReply = 0x04,
@@ -46,9 +24,6 @@
         SetTransferPackageSizeWrong = 0x11
     };
 
-    /**
-     * @enum Baud rate.
-     */
     enum Baud {
         Baud460800 = 0x02,
         Baud230400 = 0x03,
@@ -58,67 +33,35 @@
         Baud14400  = 0x07  // Default. 
     };
 
-    /**
-     *  @enum Reset type.
-     */
     enum ResetType {
         Nomal = 0x00,
         High  = 0xff
     };
 
-    /** Constructor.
-     *
-     * @param tx A pin for transmit.
-     * @param rx A pin for receive.
-     * @param baud Baud rate. (Default is 14400.)
-     */
     HeptaSerial(PinName tx, PinName rx, int baud = 14400);
 
-    /** Destructor.
-     * 
-     */
     ~HeptaSerial();
 
-    /** sync 
-     * Make a sync. for baud rate.
-     */
     ErrorNumber sync();
-
-    /** Initialize.
-     * 
-     *
-     * @param baud Camera Interface Speed.
-     * @param jr JPEG resolution.
-     */
     ErrorNumber init(Baud baud, JpegResolution jr);
-
-    /** getJpegSnapshotPicture
-     * Get JPEG snapshot picture.
-     *
-     * @param func A pointer to a callback function.
-     *             You can block this function until saving the image datas.
-     * @return Status of the error.
-     */
     ErrorNumber getJpegSnapshotPicture();
     ErrorNumber getJpegSnapshotPicture_data();
-
-    /** setmbedBaud
-     *  mbed Interface Speed.
-     *
-     *  @param baud mbed Interface Speed.
-     */
     void setmbedBaud(Baud baud);
     void Sync(void);
     void initialize(Baud baud,JpegResolution jr);
-    void test_jpeg_snapshot_picture(void);
-    void test_jpeg_snapshot_data(void);
+    void test_jpeg_snapshot_picture(int CAPTURE_FRAMES);
+    void test_jpeg_snapshot_data(int CAPTURE_FRAMES);
     void jpeg_callback(char *buf, size_t siz);
+    
+    
+    
+    
 private:
     SerialBuffered serial;
     static const int COMMAND_LENGTH = 6;
     static const int SYNCMAX = 60;
     static const int packageSize = 256;
-    static const int CAPTURE_FRAMES = 3;
+    //static const int CAPTURE_FRAMES = 3;
     
     ErrorNumber sendInitial(Baud band, JpegResolution jr);
     ErrorNumber sendGetPicture(void);