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

Use SPI Bus for multiple Devices #466

Closed
agmes4 opened this issue Jul 31, 2024 · 4 comments
Closed

Use SPI Bus for multiple Devices #466

agmes4 opened this issue Jul 31, 2024 · 4 comments

Comments

@agmes4
Copy link

agmes4 commented Jul 31, 2024

I wanna use the Spi Bus for multiple Spi Devices Problem here is that the config for one device is a bit different.
(It is taking data on raising Edge the other on falling.)

So is there any way to change config on runtime of a SpiDeviceDriver or to create two different one so I can pass one to each devices?

@Vollbrecht
Copy link
Collaborator

Why not just create two or more SpiDeviceDriver instance each with its own config that represents each MODE option?

@agmes4
Copy link
Author

agmes4 commented Jul 31, 2024

Tried that already but the driver con just be passed once cause then it get moved and after that I can not create a new one

@Vollbrecht
Copy link
Collaborator

Vollbrecht commented Jul 31, 2024

A SpiDeviceDriver takes a Borrow. If you are not familiar with Borrow you can read about here. It allows you to not only pass by &SpiDriver but also everything that implements Borrow like an Arc<SpiDriver> etc.

@agmes4
Copy link
Author

agmes4 commented Jul 31, 2024

ah thanks refactoring solved it for me the async task messed things a bit up

@agmes4 agmes4 closed this as completed Jul 31, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in esp-rs Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants