Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
nucho
Date:
Mon Aug 01 14:45:58 2011 +0000
Parent:
0:b14546a3cfab
Commit message:

Changed in this revision

RTno/BasicDataType.h Show annotated file Show diff for this revision Revisions of this file
RTno/OutPort.cpp Show annotated file Show diff for this revision Revisions of this file
RTno/PortBase.h Show annotated file Show diff for this revision Revisions of this file
RTno/ReceivePacket.cpp Show annotated file Show diff for this revision Revisions of this file
RTno/SequenceDataType.cpp Show annotated file Show diff for this revision Revisions of this file
Serial.h 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
--- a/RTno/BasicDataType.h	Fri Jul 29 11:23:06 2011 +0000
+++ b/RTno/BasicDataType.h	Mon Aug 01 14:45:58 2011 +0000
@@ -69,7 +69,8 @@
 class TimedDouble : public TimedData {
 //  Time timestamp;
 public:
-    double data;
+    //double data;
+    float data;
     virtual void* GetBuffer() {
         return &data;
     }
--- a/RTno/OutPort.cpp	Fri Jul 29 11:23:06 2011 +0000
+++ b/RTno/OutPort.cpp	Mon Aug 01 14:45:58 2011 +0000
@@ -10,7 +10,7 @@
 #include "OutPort.h"
 #include "SendPacket.h"
 #include "ReceivePacket.h"
-
+#include "Serial.h"
 
 OutPort::OutPort(char* name, TimedBoolean& Data) :
   OutPortBase(name)
@@ -132,7 +132,7 @@
 {
   int datalen = GetLength() * SizeofData();
   int namelen = strlen(GetName());
-  char packet_buffer[MAX_PACKET_SIZE];
+  char packet_buffer[MAX_PACKET_SIZE];;
   packet_buffer[0] = namelen;
   packet_buffer[1] = datalen;
   memcpy(&(packet_buffer[2]), GetName(), namelen);
--- a/RTno/PortBase.h	Fri Jul 29 11:23:06 2011 +0000
+++ b/RTno/PortBase.h	Mon Aug 01 14:45:58 2011 +0000
@@ -28,12 +28,20 @@
 
   int isSequenceType() {
     switch(m_TypeCode) {
+    /*
     case 'b':
     case 'B':
     case 'o':
     case 'O':
     case 'c':
     case 'C':
+    */
+    case 'b':
+    case 'o':
+    case 'c':
+    case 'l':
+    case 'f':
+    case 'd':
       return 0;
     default:
       return 1;
@@ -42,7 +50,7 @@
 
   int GetLength() {
     if(!isSequenceType()) {
-      return 1;
+      return  1;
     } else {
       return ((TimedDataSeq*)m_pData)->GetBuffer()->length();
     }
--- a/RTno/ReceivePacket.cpp	Fri Jul 29 11:23:06 2011 +0000
+++ b/RTno/ReceivePacket.cpp	Mon Aug 01 14:45:58 2011 +0000
@@ -15,7 +15,7 @@
 //#include <WConstants.h>
 
 int ReceivePacket(char* packet) {
-    int counter = 0;
+    //int counter = 0;
     unsigned char sum = 0;
     /*
     while (Serial.available() < PACKET_HEADER_SIZE) {
--- a/RTno/SequenceDataType.cpp	Fri Jul 29 11:23:06 2011 +0000
+++ b/RTno/SequenceDataType.cpp	Mon Aug 01 14:45:58 2011 +0000
@@ -7,9 +7,7 @@
 
 #include <stdlib.h>
 #include "SequenceDataType.h"
-#include "mbed.h"
 
-Serial pc3(p9,p10);
 
 SequenceDataType::SequenceDataType(void** ptrptr)
 {
@@ -25,9 +23,7 @@
 void SequenceDataType::length(int size)
 {
   len = size;
-  pc3.printf("len222\n\r");
   free(*m_ptrptr);
-  pc3.printf("len333\n\r");
   *m_ptrptr = (void*)malloc(size * SizeofData());
   //*m_ptrptr = (void*)malloc(size * 4);
 }
--- a/Serial.h	Fri Jul 29 11:23:06 2011 +0000
+++ b/Serial.h	Mon Aug 01 14:45:58 2011 +0000
@@ -5,6 +5,5 @@
 
 //static MODSERIAL pc(USBTX,USBRX,128,128);
 static Serial pc(USBTX,USBRX);
-//static Serial debug(p9,p10);
-
+ 
 #endif
\ No newline at end of file
--- a/main.cpp	Fri Jul 29 11:23:06 2011 +0000
+++ b/main.cpp	Mon Aug 01 14:45:58 2011 +0000
@@ -23,7 +23,7 @@
 
 #include "mbed.h"
 #include "RTno.h"
-
+#include "Serial.h"
 DigitalIn inPorts[] = {(p5), (p6),(p7),(p8),(p9),(p10)};
 DigitalOut outPorts[] = {(p15),(p16),(p17),(p18),(p19),(p20)};
 DigitalOut leds[] = {(LED1),(LED2),(LED3),(LED4)};
@@ -54,6 +54,7 @@
  * Please refer following comments. If you need to use some ports,
  * uncomment the line you want to declare.
  **/
+
 TimedLongSeq led;
 InPort ledIn("led", led);
 
@@ -63,6 +64,7 @@
 TimedLongSeq out0;
 OutPort out0Out("out0", out0);
 
+
 //////////////////////////////////////////
 // on_initialize
 //
@@ -123,6 +125,7 @@
     /*
      * Input digital data
      */
+
     if (ledIn.isNew()) {
         ledIn.read();
         for (int i = 0; i < led.data.length() && i < 4; i++) {
@@ -130,20 +133,21 @@
         }
     }
 
-    if (in0In.isNew()) {
-        in0In.read();
-        for (int i = 0; i < in0.data.length() && i < 6; i++) {
-            outPorts[i] =in0.data[i];
+
+        if (in0In.isNew()) {
+            in0In.read();
+            for (int i = 0; i < in0.data.length() && i < 6; i++) {
+                outPorts[i] =in0.data[i];
+            }
         }
-    }
-
+    
 
     /*
      * Output digital data in Voltage unit.
      */
     out0.data.length(6);
     for (int i = 0; i < 6; i++) {
-        out0.data[i] = inPorts[i];
+       out0.data[i] = inPorts[i];
     }
     out0Out.write();