Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
myrpc.cpp
00001 // myrpc.cpp 00002 // 00003 // Based on: 00004 // http://mbed.org/projects/cookbook/svn/Servo/trunk/Servo.h 00005 // http://mbed.org/projects/cookbook/svn/Servo/trunk/Servo.cpp 00006 // http://mbed.org/forum/topic/234/ 00007 00008 #include "myrpc.h" 00009 #ifdef MBED_RPC 00010 #include "rpc.h" 00011 #endif 00012 00013 00014 00015 namespace mbed { 00016 00017 myrpc::myrpc(PinName pin, const char *name) : Base(name), _pin(pin) {} 00018 00019 00020 void myrpc::ledon(int n) { 00021 _pin = 1; 00022 } 00023 00024 void myrpc::ledoff(int n) { 00025 _pin = 0; 00026 } 00027 00028 00029 #ifdef MBED_RPC 00030 const rpc_method *myrpc::get_rpc_methods() { 00031 static const rpc_method rpc_methods[] = { 00032 { "ledon", rpc_method_caller<myrpc, int, &myrpc::ledon> }, 00033 { "ledoff", rpc_method_caller<myrpc, int, &myrpc::ledoff> }, 00034 RPC_METHOD_SUPER(Base) 00035 }; 00036 return rpc_methods; 00037 } 00038 rpc_class *myrpc::get_rpc_class() { 00039 static const rpc_function funcs[] = { 00040 "new", rpc_function_caller<const char*, PinName, const char*, &Base::construct<myrpc,PinName,const char*> >, 00041 RPC_METHOD_END 00042 }; 00043 static rpc_class c = { "myrpc", funcs, NULL }; 00044 return &c; 00045 } 00046 #endif 00047 00048 } // namespace mbed
Generated on Fri Jul 15 2022 16:15:11 by
1.7.2