SerialGPS.

Dependents:   SerialGPS_TestProgram Nucleo_SerialGPS_to_PC Nucleo_SerialGPS_to_PC SensorInterface ... more

Files at this revision

API Documentation at this revision

Comitter:
shintamainjp
Date:
Tue Oct 12 22:22:28 2010 +0000
Parent:
0:3d0c5d7e5d0a
Commit message:
First version.

Changed in this revision

SerialBuffered.cpp Show annotated file Show diff for this revision Revisions of this file
SerialBuffered.h Show annotated file Show diff for this revision Revisions of this file
SerialGPS.cpp Show annotated file Show diff for this revision Revisions of this file
SerialGPS.h Show annotated file Show diff for this revision Revisions of this file
diff -r 3d0c5d7e5d0a -r a5b887e09aa4 SerialBuffered.cpp
--- a/SerialBuffered.cpp	Mon Sep 20 06:03:38 2010 +0000
+++ b/SerialBuffered.cpp	Tue Oct 12 22:22:28 2010 +0000
@@ -1,6 +1,12 @@
 #include "mbed.h"
 #include "SerialBuffered.h"
 
+/**
+ * Create a buffered serial class.
+ *
+ * @param tx A pin for transmit.
+ * @param rx A pin for receive.
+ */
 SerialBuffered::SerialBuffered(PinName tx, PinName rx) : Serial(tx, rx) {
     indexContentStart = 0;
     indexContentEnd = 0;
@@ -8,13 +14,29 @@
     attach(this, &SerialBuffered::handleInterrupt);
 }
 
+/**
+ * Destroy.
+ */
 SerialBuffered::~SerialBuffered() {
 }
 
+/**
+ * Set timeout for getc().
+ *
+ * @param ms milliseconds. (-1:Disable timeout)
+ */
 void SerialBuffered::setTimeout(int ms) {
     timeout = ms;
 }
 
+/**
+ * Read requested bytes.
+ *
+ * @param bytes A pointer to a buffer.
+ * @param requested Length.
+ *
+ * @return Readed byte length.
+ */
 size_t SerialBuffered::readBytes(uint8_t *bytes, size_t requested) {
     int i = 0;
     while (i < requested) {
@@ -28,6 +50,11 @@
     return i;
 }
 
+/**
+ * Get a character.
+ *
+ * @return A character. (-1:timeout)
+ */
 int SerialBuffered::getc() {
     timer.reset();
     timer.start();
@@ -49,6 +76,9 @@
     return result;
 }
 
+/**
+ * Returns 1 if there is a character available to read, 0 otherwise.
+ */
 int SerialBuffered::readable() {
     return indexContentStart != indexContentEnd;
 }
diff -r 3d0c5d7e5d0a -r a5b887e09aa4 SerialBuffered.h
--- a/SerialBuffered.h	Mon Sep 20 06:03:38 2010 +0000
+++ b/SerialBuffered.h	Tue Oct 12 22:22:28 2010 +0000
@@ -13,7 +13,7 @@
      * @param rx A pin for receive.
      */
     SerialBuffered(PinName tx, PinName rx);
-    
+
     /**
      * Destroy.
      */
@@ -50,7 +50,7 @@
 
 private:
     void handleInterrupt();
-    static const int BUFFERSIZE = 4096;
+    static const int BUFFERSIZE = 2048;
     uint8_t buffer[BUFFERSIZE];            // points at a circular buffer, containing data from m_contentStart, for m_contentSize bytes, wrapping when you get to the end
     uint16_t indexContentStart;   // index of first bytes of content
     uint16_t indexContentEnd;     // index of bytes after last byte of content
diff -r 3d0c5d7e5d0a -r a5b887e09aa4 SerialGPS.cpp
--- a/SerialGPS.cpp	Mon Sep 20 06:03:38 2010 +0000
+++ b/SerialGPS.cpp	Tue Oct 12 22:22:28 2010 +0000
@@ -50,7 +50,7 @@
             src[cnt++] = c & 0xff;
         } while (!done);
     } while (cnt <= 1);
-
+    
     /*
      * Return if the callback function does not exists.
      */
diff -r 3d0c5d7e5d0a -r a5b887e09aa4 SerialGPS.h
--- a/SerialGPS.h	Mon Sep 20 06:03:38 2010 +0000
+++ b/SerialGPS.h	Tue Oct 12 22:22:28 2010 +0000
@@ -56,7 +56,7 @@
     } gps_gga_t;
 
     /**
-     * GSA&#226;&#8364;hGNSS DOP and Active Satellites.
+     * GSA&#226;&#8364;&#129;hGNSS DOP and Active Satellites.
      *
      * $GPGSA,A,3,07,02,26,27,09,04,15, , , , , ,1.8,1.0,1.5*33
      */