-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
159 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,71 @@ | ||
Usage | ||
===== | ||
|
||
Device | ||
------ | ||
|
||
.. code:: cpp | ||
#include <simpleRPC.h> | ||
.. code:: cpp | ||
void setup(void) { | ||
Serial.begin(9600); | ||
} | ||
void loop(void) { | ||
interface(); | ||
} | ||
.. code:: cpp | ||
int add(int a, int b) { | ||
return a + b; | ||
} | ||
.. code:: cpp | ||
INTERFACE("Add two integers. @P:Value a. @P:Value b. @R:Sum of a and b.", | ||
int, add, int, int) | ||
Host | ||
---- | ||
|
||
Library | ||
~~~~~~~ | ||
|
||
.. code:: python | ||
>>> from simple_rpc import Interface | ||
>>> | ||
>>> interface = Interface('/dev/ttyACM0') | ||
>>> interface.add(1, 2) | ||
3 | ||
.. code:: python | ||
>>> help(interface.add) | ||
Command line interface | ||
~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. code:: | ||
$ simple_rpc list | ||
Available methods: | ||
add arg0 arg1 | ||
Add two integers. | ||
arg0 (type int): Value a. | ||
arg1 (type int): Value b. | ||
returns (type int): Sum of a and b. | ||
.. code:: | ||
$ simple_rpc call add 1 2 | ||
3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,3 +125,10 @@ void interface(void) { | |
} | ||
|
||
#undef INTERFACE | ||
|
||
/** | ||
* Test function. | ||
*/ | ||
int ping(int x) { | ||
return x; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters