Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

riot: Add SAUL bindings #1

Open
wants to merge 2 commits into
base: add_riot_port
Choose a base branch
from

Conversation

bergzand
Copy link

@bergzand bergzand commented Dec 5, 2019

This PR adds SAUL bindings for micropython. See the included docs in ports/riot/riot_saul.c for usage instructions.

Future work could consist of bindings for SAUL devices written as python modules.

/// and the driver implementation. A NotImplemented exception will be raised if
/// the underlying device driver does not support the call.
///
/// A succesful read from a device will return a list of floating point numbers
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// A succesful read from a device will return a list of floating point numbers
/// A successful read from a device will return a list of floating point numbers

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@bergzand
Copy link
Author

bergzand commented Dec 6, 2019

Looks like I managed to break the bindings with some last minute changes to this PR.

@bergzand
Copy link
Author

bergzand commented Dec 6, 2019

Should work again. the type attribute is changed to a method (type()) to simplify the implementation. I've also added iterator functions to the registry class to be able to iterate over the devices in the registry:

from riot import saul

reg = saul.get_registry()
for device in reg:
    print("{}: {}".format(device, device.read()))

gives:

SAUL actuator: "LED(orange)": [1.0]
SAUL sensor: "Button(SW0)": [0.0]

(On a samr21-xpro)

@bergzand
Copy link
Author

ping @kaspar030

OlegHahm pushed a commit to OlegHahm/micropython that referenced this pull request Dec 6, 2023
riot: add unique_id() support based on cpuid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants