Skip to content

riot: Add SAUL bindings#1

Open
bergzand wants to merge 2 commits intokaspar030:add_riot_portfrom
bergzand:add_riot_saul
Open

riot: Add SAUL bindings#1
bergzand wants to merge 2 commits intokaspar030:add_riot_portfrom
bergzand:add_riot_saul

Conversation

@bergzand
Copy link
Copy Markdown

@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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