generated from BrianPugh/python-template
-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from BrianPugh/multiple-devices
Multiple device support
- Loading branch information
Showing
11 changed files
with
303 additions
and
79 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
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
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
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,7 +1,29 @@ | ||
API | ||
=== | ||
|
||
.. autoclass:: belay.Device | ||
:members: | ||
|
||
.. method:: task(f: Optional[Callable[..., None]] = None, /, minify: bool = True, register: bool = True) | ||
|
||
Decorator that send code to device that executes when decorated function is called on-host. | ||
|
||
:param Callable f: Function to decorate. | ||
:param bool minify: Minify ``cmd`` code prior to sending. Defaults to ``True``. | ||
:param bool register: Assign an attribute to ``self.task`` with same name as ``f``. Defaults to ``True``. | ||
|
||
.. method:: thread(f: Optional[Callable[..., None]] = None, /, minify: bool = True, register: bool = True) | ||
|
||
Decorator that send code to device that spawns a thread when executed. | ||
|
||
:param Callable f: Function to decorate. | ||
:param bool minify: Minify ``cmd`` code prior to sending. Defaults to ``True``. | ||
:param bool register: Assign an attribute to ``self.thread`` with same name as ``f``. Defaults to ``True``. | ||
|
||
|
||
|
||
.. automodule:: belay | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
:exclude-members: Device |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Example 08: Multiple Devices | ||
============================ | ||
|
||
Belay can interact with multiple micropython boards on different ports. | ||
Tasks and Threads can be decorated multiple times from different devices. | ||
When invoked, the resulting decorated function will execute on the devices in the order that they were decorated (bottom upwards). | ||
|
||
To execute a task on just one specific device, it can be accessed like ``device1.task.set_led``. | ||
Similarly, to execute a thread on just one specific device, call ``device1.thread.blink_loop``. |
Oops, something went wrong.