Fork of mbed RPC_serial to fix build errors. mbed RPC_Serial for LabVIEW interface: http://mbed.org/cookbook/Interfacing-with-LabVIEW http://mbed.org/cookbook/Interfacing-Using-RPC Steps: *Compile RPC_Serial main *Copy bit file to mbed flash and reset *Run examples in LabVIEW

Dependencies:   mbed-rpc mbed

Fork of RPC_Serial by Harris Junaid

Revision:
2:fe5692354530
Parent:
1:c7b247964631
--- a/main.cpp	Thu Apr 23 23:35:11 2015 +0000
+++ b/main.cpp	Fri Apr 24 03:20:22 2015 +0000
@@ -1,27 +1,63 @@
 #include "mbed.h"
-#include "rpc.h"
+#include "mbed_rpc.h"
+
+//using namespace mbed;
 
 Serial pc(USBTX, USBRX);
 
 int main() {
     // setup the classes that can be created dynamically
-    RPC::add_rpc_class<AnalogIn>();
-    RPC::add_rpc_class<AnalogOut>();
-    RPC::add_rpc_class<DigitalIn>();
-    RPC::add_rpc_class<DigitalOut>();
-    RPC::add_rpc_class<DigitalInOut>();
-    RPC::add_rpc_class<PwmOut>();
-    RPC::add_rpc_class<Timer>();
-    RPC::add_rpc_class<SPI>();
-    RPC::add_rpc_class<BusOut>();
-    RPC::add_rpc_class<BusIn>();
-    RPC::add_rpc_class<BusInOut>();
-    RPC::add_rpc_class<Serial>();
+    
+    //These exist for all platforms
+    RPC::add_rpc_class<RpcDigitalIn>();
+    RPC::add_rpc_class<RpcDigitalOut>();
+    RPC::add_rpc_class<RpcDigitalInOut>();
+    RPC::add_rpc_class<RpcTimer>();
+    
+    //Others are conditional by platform
+    
+    //Unknown how RPC would work if serial was not present?
+    #if DEVICE_SERIAL
+    RPC::add_rpc_class<RpcSerial>();
+    #else
+    #warning "No Serial function available in this configuration."
+    #endif
+    
+    #if DEVICE_ANALOGIN
+    RPC::add_rpc_class<RpcAnalogIn>();
+    #else
+    #warning "No AnalogIn function available in this configuration."
+    #endif
+    
+    #if DEVICE_ANALOGOUT
+    RPC::add_rpc_class<RpcAnalogOut>();
+    #else
+    #warning "No AnalogOut function available in this configuration."
+    #endif
+    
+    #if DEVICE_PWMOUT
+    RPC::add_rpc_class<RpcPwmOut>();
+    #else
+    #warning "No PWMOut function available in this configuration."
+    #endif
+    
+    #if DEVICE_SPI
+    RPC::add_rpc_class<RpcSPI>();
+    #else
+    #warning "No SPI function available in this configuration."
+    #endif
+    
+    //These appear to not be implemented
+    //RPC::add_rpc_class<BusOut>();
+    //RPC::add_rpc_class<RpcBusIn>();
+    //RPC::add_rpc_class<RpcBusInOut>();
+    
     // receive commands, and send back the responses
-    char buf[256], outbuf[256];
+    char buf[RPC_MAX_STRING], outbuf[RPC_MAX_STRING];
     while(1) {
-        pc.gets(buf, 256);
-        rpc(buf, outbuf); 
+        pc.gets(buf, RPC_MAX_STRING);
+        RPC::call(buf, outbuf); 
         pc.printf("%s\n", outbuf);
     }
+    
 }