Added NUCLEO-F103RB support

Dependents:   F103-Web-Server

Fork of mbed-rpc by Mbed

Files at this revision

API Documentation at this revision

Comitter:
olympux
Date:
Sat Aug 20 23:09:11 2016 +0000
Parent:
20:635b0fd3d1bd
Commit message:
Removed unnecessary files

Changed in this revision

RPCType.cpp Show annotated file Show diff for this revision Revisions of this file
RPCType.h Show annotated file Show diff for this revision Revisions of this file
diff -r 635b0fd3d1bd -r 6c1c766b8988 RPCType.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RPCType.cpp	Sat Aug 20 23:09:11 2016 +0000
@@ -0,0 +1,59 @@
+#include "mbed.h"
+#include "mbed_rpc.h"
+#include "RPCType.h"
+
+
+RPCType::RPCType():
+supported_types()
+{
+}
+
+RPCType& RPCType::instance()
+{
+    static RPCType t;
+    return t;
+}
+
+void RPCType::register_types()
+{
+    RPCType &t = instance();
+    
+    RPC::add_rpc_class<RpcDigitalOut>();
+    t.supported_types.push_back("DigitalOut");
+    RPC::add_rpc_class<RpcDigitalIn>();
+    t.supported_types.push_back("DigitalIn");
+    RPC::add_rpc_class<RpcDigitalInOut>();
+    t.supported_types.push_back("DigitalInOut");
+
+    #if DEVICE_ANALOGIN
+    RPC::add_rpc_class<RpcAnalogIn>();
+    t.supported_types.push_back("AnalogIn");
+    #endif
+    #if DEVICE_PWMOUT
+    RPC::add_rpc_class<RpcPwmOut>();
+    t.supported_types.push_back("PwmOut");
+    #endif
+    #if DEVICE_SPI
+    t.supported_types.push_back("SPI");
+    RPC::add_rpc_class<RpcSPI>();
+    #endif
+    #if DEVICE_SERIAL
+    t.supported_types.push_back("Serial");
+    RPC::add_rpc_class<RpcSerial>();
+    #endif
+    RPC::add_rpc_class<RpcTimer>();
+    t.supported_types.push_back("Timer");
+}
+
+bool RPCType::is_supported_type(char *type)
+{
+    for(std::list<char*>::iterator itor = instance().supported_types.begin();
+        itor != instance().supported_types.end();
+        ++itor)
+        if(!strcmp(*itor,type))
+            return true;
+
+    return false;
+}
+
+
diff -r 635b0fd3d1bd -r 6c1c766b8988 RPCType.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RPCType.h	Sat Aug 20 23:09:11 2016 +0000
@@ -0,0 +1,23 @@
+#ifndef RPCTYPE_H
+#define RPCTYPE_H
+
+#include <list>
+
+class RPCType
+{
+    public :
+        
+        static RPCType& instance();
+        
+        void register_types();
+        
+        bool is_supported_type(char *type);
+        
+    private :
+
+        RPCType();
+        std::list<char*> supported_types;
+};
+
+#endif
+