SerialGPS.

Dependents:   SerialGPS_TestProgram Nucleo_SerialGPS_to_PC Nucleo_SerialGPS_to_PC SensorInterface ... more

Revision:
1:a5b887e09aa4
Parent:
0:3d0c5d7e5d0a
--- 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;
 }